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.

A267830 Number of nonprime numbers in {n, f(n), f(f(n)), ...., 1}, where f is the Collatz function defined by f(x) = x/2 if x is even; f(x) = 3x + 1 if x is odd.

Original entry on oeis.org

1, 1, 5, 2, 4, 6, 11, 3, 14, 5, 10, 7, 7, 12, 14, 4, 9, 15, 14, 6, 7, 11, 12, 8, 17, 8, 87, 13, 13, 15, 83, 5, 20, 10, 11, 16, 15, 15, 24, 7, 85, 8, 22, 12, 13, 13, 82, 9, 18, 18, 19, 9, 9, 88, 89, 14, 25, 14, 22, 16, 15, 84, 88, 6, 21, 21, 19, 11, 12, 12, 81
Offset: 1

Views

Author

Michel Lagneau, Jan 21 2016

Keywords

Comments

Number of nonprime numbers in the trajectory of n under the 3x+1 map (i.e., the number of nonprime numbers until the trajectory reaches 1).
It seems that about 20% of the terms satisfy a(i) = a(i+1). For example, up to 10^6, 201085 terms satisfy this condition.

Examples

			a(9)=14 because the trajectory of 9 is 9 -> 28 -> 14 -> 7 -> 22 -> 11 -> 34 -> 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 and the 14 nonprimes of this trajectory are 9, 28, 14, 22, 34, 52, 26, 40, 20, 10, 16, 8, 4, and 1.
		

Crossrefs

Programs

  • Mathematica
    A267830[n_] := Count[NestWhileList[If[EvenQ@#, #/2, 3 # + 1] &, n, # != 1 &], ?(Not@PrimeQ@# &)] (* _JungHwan Min, Jan 24 2016 *)
  • PARI
    for(n=1, 100, s=n; t=0; while(s!=1, if(!isprime(s) , t++); if(s%2==0, s=s/2, s=(3*s+1)); if(s==1, print1(t+1, ", "); ); ))

Formula

a(n)= A008908(n) - A078350(n).