OFFSET
1,1
COMMENTS
The sequence is infinite provided the Collatz conjecture is true.
Conjecture: every prime number is encountered except 3.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
The first eligible composite is 9. The mechanism gives 3 * 9 + 1 = 28, followed by 28/2 = 14,then 14/2 = 7. This is the first prime encountered starting at 9 and enters the sequence as a(1).
The next odd composite is 15. The mechanism gives 3 * 15 + 1 = 46, followed by 46/2 = 23. This is the first prime encountered starting at 15 and enters the sequence as a(2).
MATHEMATICA
nwp[n_]:=NestWhile[If[EvenQ[#], #/2, 3#+1]&, n, !PrimeQ[#]&]; nwp/@Select[ Range[ 1, 251, 2], CompositeQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 05 2020 *)
PROG
(PARI)
genit(maxx)={i5=9; while(i5<=maxx, evalx=i5; if(!isprime(evalx), while(!isprime(evalx), if(evalx%2==0, evalx=evalx/2, evalx=3*evalx+1)); print1(evalx, ", ")); i5+=2); }
CROSSREFS
KEYWORD
nonn
AUTHOR
Bill McEachen, May 17 2016
STATUS
approved