#include <stdio.h> int w=1; int f(int p); int main(void) { int n; f(n); return 0; } int f(int p) { if(p==1) { } else if(p%2==1) { p=3*p+1; w=w+1; f(p); } else if(p%2==0) { p=p/2; w=w+1; f(p); } }
100
hailstone numbers:100, 50, 25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, no. of steps:26