Proving a value is the result of the execution of an algorithm
This is known as verifiable computing or verified computation.  There are many protocols for verified computation, with different properties.  Some of them rely upon special hardware (e.g., SGX).  Many of them don't rely on special hardware and use cryptography.  Among the cryptographic solutions, there are some protocols that can be used with any program (but are potentially inefficient), and some that can only be used for specific programs or types of computations (but are much more efficient).

There's an entire line of research papers on the subject, and it is too broad to summarize in a single paragraph or two.  I suggest reading about interactive proofs, and about the Pepper, Ginger, Zaatar, Pinocchio, Pantry, and Truebit systems, among others.  I also recommend reading the following survey paper for an overview of cryptographic solutions that can handle general computation:


Verifying computations without reexecuting them, Michael Walfish, Andrew J. Blumberg, CACM 58(2), February 2015.


In practice, I suspect that the SGX-based schemes or Truebit are likely to be the most practical for general computation at the moment, though the research literature is progressing rapidly and this could change in the future.  For specific computations, it is sometimes possible to design a custom protocol that does much better, but that depends on the particular computation.