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.

Showing 1-2 of 2 results.

A258822 Number of times that k iterations of n under the '3x+1' map yield k for some k.

Original entry on oeis.org

0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Derek Orr, Jun 11 2015

Keywords

Comments

This sequence uses the definition in A006370: if n is odd, n -> 3*n+1, if n is even, n -> n/2.
The number 3 appears first at a(63105). Do all nonnegative numbers appear? See A258824.

Examples

			For n = 6, the '3x+1' map is as follows: 6 -> 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. Here the number of iterations is 8. However, after the k-th iteration, the result does not equal k. Thus a(6) = 0.
For n = 7, the '3x+1' map is as follows: 7 -> 22 -> 11 -> 34 -> 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. Only after 10 iterations do we arrive at 10. Since this is the only time this happens, a(7) = 1.
		

Crossrefs

Programs

  • Mathematica
    A258822[n_]:=Count[MapIndexed[{#1}==#2-1&,NestWhileList[If[OddQ[#],3#+1,#/2]&,n,#>1&]],True];Array[A258822,100] (* Paolo Xausa, Nov 06 2023 *)
  • PARI
    Tvect(n)=v=[n]; while(n!=1, if(n%2, k=(3*n+1); v=concat(v, k); n=k); if(!(n%2), k=n/2; v=concat(v, k); n=k)); v
    for(n=1, 200, d=Tvect(n); c=0; for(i=1, #d, if(d[i]==i-1, c++)); print1(c, ", "))

A258828 Least number k such that A258825(k) = n.

Original entry on oeis.org

1, 2, 105, 305
Offset: 0

Views

Author

Derek Orr, Jun 11 2015

Keywords

Comments

If it exists, a(n) > 10^6 for n > 3.
For n = 2, after 17 and 20 iterations, you arrive at 17 and 20, respectively. It appears the total number of iterations of the possible k values is either 26 or 33.
For n = 3, after 14, 17, and 20 iterations, you arrive at 14, 17, and 20, respectively. It appears the total number of iterations of the possible k values is 26.

Examples

			For n = 105, the Collatz function does the following: 105 -> 158 -> 79 -> 119 -> 179 -> 269 -> 404 -> 202 -> 101 -> 152 -> 76 -> 38 -> 19 -> 29 -> 44 -> 22 -> 11 -> 17 -> 26 -> 13 -> 20 -> 10 -> 5 -> 8 -> 4 -> 2 -> 1. After the 17th and 20th iteration, we can see we reach 17 and 20, respectively. Since 105 is the smallest number to have exactly two occurrences, a(2) = 105. Note that there are 26 iterations before you reach 1. It appears that all numbers with exactly two occurrences have either 26 or 33 total iterations to get to 1.
For n = 305, the Collatz function does the following: 305 -> 458 -> 229 -> 344 -> 172 -> 86 -> 43 -> 65 -> 98 -> 49 -> 74 -> 37 -> 56 -> 28 -> 14 -> 7 -> 11 -> 17 -> 26 -> 13 -> 20 -> 10 -> 5 -> 8 -> 4 -> 2 -> 1. After the 14th, 17th, and 20th iteration, we can see we reach 14, 17, and 20, respectively. Since 305 is the smallest number to have exactly 3 occurrences, a(3) = 305. Note that there are 26 iterations before you reach 1. It appears that all numbers with exactly three occurrences have 26 total iterations to get to 1.
		

Crossrefs

Programs

  • PARI
    Tvect(n)=v=[n]; while(n!=1, if(n%2, k=(3*n+1)/2; v=concat(v, k); n=k); if(!(n%2), k=n/2; v=concat(v, k); n=k)); v
    n=0; m=1; while(m<10^3, d=Tvect(m); c=0; for(i=1, #d, if(d[i]==i-1, c++)); if(c==n, print1(m, ", "); m=0; n++); m++)
Showing 1-2 of 2 results.