A317753 Number of steps to reach 1 in 7x+-1 problem, or -1 if 1 is never reached.
0, 1, 13, 2, 10, 14, 18, 3, 7, 11, 53, 15, 19, 19, 23, 4, 27, 8, 50, 12, 73, 54, 16, 16, 58, 20, 20, 20, 43, 24, 24, 5, 47, 28, 325, 9, 70, 51, 32, 13, 13, 74, 272, 55, 55, 17, 17, 17, 276, 59, 40, 21, 40, 21, 21, 21, 63, 44, 63
Offset: 1
Examples
a(5)=10 because the trajectory of 5 is (5, 36, 18, 9, 64, 32, 16, 8, 4, 2, 1).
Links
- David Barina, Table of n, a(n) for n = 1..10000
- D. Barina, 7x+-1: Close Relative of Collatz Problem, arXiv:1807.00908 [math.NT], 2018.
- K. Matthews, David Barina's 7x+1 conjecture.
Programs
-
C
int a(int n) { int s = 0; while( n != 1 ) { switch(n%4) { case 1: n = 7*n+1; break; case 3: n = 7*n-1; break; default: n = n/2; } s++; } return s; }
-
Mathematica
f[n_] := Switch[Mod[n, 4], 0, n/2, 1, 7 n + 1, 2, n/2, 3, 7 n - 1]; a[n_] := Length@NestWhileList[f, n, # > 1 &] - 1; Array[a, 70] (* Robert G. Wilson v, Aug 07 2018 *)
-
PARI
a(n) = my(nb=0); while(n != 1, if (!((n-1)%4), n = 7*n+1, if (!((n+1)%4), n = 7*n-1, n = n/2)); nb++); nb; \\ Michel Marcus, Aug 06 2018
Comments