Comment by kelseyfrog

4 days ago

Just curious, but what's the definition of collatz(long) look like?

https://en.wikipedia.org/wiki/Collatz_conjecture

  • I meant the C++ definition of collatz that would verify the precondition.

    • I haven't tried it and am afk rn but I'd imagine you just define a constexpr function that implements collatz and use that in your contract.

      (Edit: if the input is constexpr itself) Its also quire easy to think about specializing a few templates and doing it that way. If you look up an example of the fib sequence in c++ templates you'll get the general idea.

      8 replies →