cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A341516 The Collatz or 3x+1 function T (A014682) conjugated by unary-binary-encoding (A156552).

Original entry on oeis.org

1, 3, 2, 6, 3, 7, 5, 12, 4, 27, 7, 14, 11, 75, 6, 24, 13, 35, 17, 54, 10, 147, 19, 28, 9, 363, 8, 150, 23, 13, 29, 48, 14, 507, 15, 70, 31, 867, 22, 108, 37, 343, 41, 294, 12, 1083, 43, 56, 25, 63, 26, 726, 47, 175, 21, 300, 34, 1587, 53, 26, 59, 2523, 20, 96, 33, 847, 61, 1014, 38, 243, 67, 140, 71, 2883, 18, 1734
Offset: 1

Views

Author

Antti Karttunen, Feb 15 2021

Keywords

Comments

Collatz-conjecture can be formulated via this sequence by postulating that all iterations of a(n), starting from any n > 1, will eventually end reach the cycle [2, 3].

Crossrefs

Cf. A341515 for a variant.

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = { my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res };
    A329603(n) = A005940(2+(3*A156552(n)));
    A341516(n) = if(n%2, A064989(n), A064989(A329603(n)));

Formula

If n is odd, then a(n) = A064989(n), otherwise a(n) = A064989(A329603(n)).
a(n) = A005940(1+A014682(A156552(n))).