aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/examples/collatz.se
blob: 148b47b59c3d4236750f9210e26703e6e07ae267 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
x = msg.data[0]
steps = 0

while x > 1:
    steps += 1
    if (x % 2) == 0:
        x /= 2
    else:
        x = 3 * x + 1

return(steps)