login
A322521
If A319303(k) = n for some k, then a(n) = k, else a(n) = -1.
2
0, 1, 12, 2, 6, 16, 198, 3, 454, 8, 102, 20, 22, 262, 378, 4, 54, 582, 742, 10, 11, 134, 186, 24, 1766, 30, 918403141209018, 326, 358, 506, 214715699432378, 5, 3814, 70, 90, 710, 774, 998, 51174, 14, 496190676143034, 15, 6918, 166, 182, 250, 109162583165882
OFFSET
1,3
COMMENTS
If the Collatz conjecture is true, then this sequence contains every nonnegative integers.
EXAMPLE
A319303(18) = 80, hence a(80) = 18.
MATHEMATICA
a[n0_] := Module[{n=n0, v=0}, While[n>1, t = If[OddQ[n], 3n+1, n/2]; If[t>4 && Mod[t+2, 6] == 0, v *= 2; v += Mod[n, 2]]; n = t; v++]; v]
Array[a, 50] (* Jean-François Alcover, Dec 18 2018, translated from PARI *)
PROG
(PARI) a(n) = my (v=0); while (n>1, my (t=if (n%2, 3*n+1, n/2)); if (t>4 && (t+2)%6==0, v*=2; v+=n%2); n=t; v++); v
CROSSREFS
Cf. A319303.
Sequence in context: A054383 A036383 A107832 * A099136 A215416 A264970
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Dec 13 2018
STATUS
approved