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.

A087272 a(n) is the largest prime number in 3x+1 trajectory initiated at n.

This page as a plain text file.
%I A087272 #13 Feb 27 2023 15:49:21
%S A087272 2,5,2,5,5,17,2,17,5,17,5,13,17,53,2,17,17,29,5,2,17,53,5,29,13,1619,
%T A087272 17,29,53,1619,2,29,17,53,17,37,29,101,5,1619,2,43,17,17,53,1619,5,37,
%U A087272 29,29,13,53,1619,1619,17,43,29,101,53,61,1619,1619,2,37,29,101,17,13,53
%N A087272 a(n) is the largest prime number in 3x+1 trajectory initiated at n.
%H A087272 Rémy Sigrist, <a href="/A087272/b087272.txt">Table of n, a(n) for n = 2..10000</a>
%t A087272 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}]
%t A087272 Table[Max[Select[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&],PrimeQ]],{n,2,70}] (* _Harvey P. Dale_, Feb 27 2023 *)
%o A087272 (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
%Y A087272 Cf. A025586, A055510, A087232.
%K A087272 nonn
%O A087272 2,1
%A A087272 _Labos Elemer_, Sep 18 2003
%E A087272 Offset corrected by _Rémy Sigrist_, Oct 08 2018