OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
N:= 1000; # to get the first N terms
Collatz:= proc(n) option remember;
if n::even then 1+Collatz(n/2)
else 1+Collatz(3*n+1)
fi
end proc;
Collatz(1):= 0;
count:= 0;
for i from 1 while count < N do
x:= Collatz(i);
if isprime(x) then count:= count+1; A[count]:= x fi;
od:
seq(A[i], i=1..N); # Robert Israel, Jun 01 2014
MATHEMATICA
M = 100;
Collatz[n_] := Collatz[n] = If[EvenQ[n], 1+Collatz[n/2], 1+Collatz[3n+1]];
Collatz[1] = 0;
count = 0;
For[i = 1, count < M, i++, x = Collatz[i]; If[PrimeQ[x], count = count+1; a[count] = x]];
Array[a, M] (* Jean-François Alcover, Mar 26 2019, after Robert Israel *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
K. B. Subramaniam (kb_subramaniambalu(AT)yahoo.com), Dec 20 2001
EXTENSIONS
More terms from Sascha Kurz, Mar 23 2002
Offset corrected by Robert Israel, Jun 01 2014
STATUS
approved