editing
approved
editing
approved
Table[Max[Select[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #>1&], PrimeQ]], {n, 2, 70}] (* Harvey P. Dale, Feb 27 2023 *)
approved
editing
editing
approved
reviewed
approved
proposed
reviewed
editing
proposed
a(n) is the largest prime number in 3x+1 trajectory initiated at n;.
1,2,1
Rémy Sigrist, <a href="/A087272/b087272.txt">Table of n, a(n) for n = 2..10000</a>
(PARI) a(n) = my (mx=2); while (n>1, if (isprime(n), mx=max(mx, n)); n=if (n%2, 3*n+1, n/2)); mx \\ Rémy Sigrist, Oct 08 2018
Offset corrected by Rémy Sigrist, Oct 08 2018
approved
editing
_Labos E. (labos(AT)ana.sote.hu), Elemer_, Sep 18 2003
c[x_] := (1-Mod[x, 2])*(x/2)+Mod[x, 2]*(3*x+1); c[1]=1; fpl[x_] := Delete[FixedPointList[c, x], -1] ofp[x_] := Part[fpl[x], Flatten[Position[PrimeQ[fpl[x]], True]]] Table[Max[ofp[w]], {w, 1, 256}]
nonn,new
nonn