OFFSET
1,3
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.
LINKS
Michel Lagneau, Table of n, a(n) for n = 1..10000
EXAMPLE
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.
MATHEMATICA
A267830[n_] := Count[NestWhileList[If[EvenQ@#, #/2, 3 # + 1] &, n, # != 1 &], _?(Not@PrimeQ@# &)] (* JungHwan Min, Jan 24 2016 *)
PROG
(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, ", "); ); ))
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jan 21 2016
STATUS
approved