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.

A304715 For any n > 0, if A006666(n) >= 0, then a(n) = Sum_{i = 0..A006666(n)-1} 2^i * [T^i(n) == 0 (mod 2)] (where [] is an Iverson bracket and T^i denotes the i-th iterate of the Collatz function A014682); otherwise a(n) = -1.

Original entry on oeis.org

0, 1, 28, 3, 14, 57, 1896, 7, 7586, 29, 948, 115, 118, 3793, 3824, 15, 474, 15173, 15180, 59, 62, 1897, 1912, 231, 60722, 237, 1102691417057682138372, 7587, 7590, 7649, 137836427132210267296, 31, 242890, 949, 956, 30347, 30350, 30361, 7772616, 119
Offset: 1

Views

Author

Rémy Sigrist, May 17 2018

Keywords

Comments

In other words, when a(n) >= 0, the binary representation of a(n) encodes the tripling and halvings steps of the Collatz compressed trajectory of n up to the first occurrence of the number 1 (where zeros and ones respectively denote tripling and halving steps).

Examples

			The first terms, alongside the binary representation of a(n) and the Collatz compressed trajectory of a(n) up to the first 1 in reverse order, are:
  n    a(n)       bin(a(n))  rev(traj(n))
  --   ----       ---------  ------------
   1      0               0  (1)
   2      1               1  (1, 2)
   3     28           11100  (1, 2, 4, 8, 5, 3)
   4      3              11  (1, 2, 4)
   5     14            1110  (1, 2, 4, 8, 5)
   6     57          111001  (1, 2, 4, 8, 5, 3, 6)
   7   1896     11101101000  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11, 7)
   8      7             111  (1, 2, 4, 8)
   9   7586   1110110100010  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11, 7, 14, 9)
  10     29           11101  (1, 2, 4, 8, 5, 10)
  11    948      1110110100  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11)
  12    115         1110011  (1, 2, 4, 8, 5, 3, 6, 12)
  13    118         1110110  (1, 2, 4, 8, 5, 10, 20, 13)
  14   3793    111011010001  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11, 7, 14)
  15   3824    111011110000  (1, 2, 4, 8, 5, 10, 20, 40, 80, 53, 35, 23, 15)
  16     15            1111  (1, 2, 4, 8, 16)
  17    474       111011010  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17)
  18  15173  11101101000101  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11, 7, 14, 9, 18)
		

Crossrefs

Programs

  • PARI
    a(n) = my (v=0); for (k=0, oo, if (n==1, return (v), n%2, n = (3*n+1)/2, n = n/2; v += 2^k))

Formula

a(2^k) = 2^k - 1 for any k >= 0.
a(2*n) = 2*a(n) + 1.
A029837(a(n)+1) = A006666(n).
A000120(a(n)) = A220071(n).
a(A248573(n)) < a(A248573(n+1)) for any n >= 0. - Rémy Sigrist, Nov 09 2018