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.

A057690 Length of cycle in trajectory of P under the 'Px+1' map, where P = n-th prime, or -1 if trajectory does not cycle.

This page as a plain text file.
%I A057690 #32 Dec 12 2023 08:25:31
%S A057690 3,3,4,4,3,4,4,5,4,6,3,4,4,6,5,5,3,4,6,3,6,5,5,4,4,5,6,4,4,8,5,4,5,5,
%T A057690 5,3,4,6,4,6,4,8,3,5,6,4,7,5,4,5,7,4,6,4,6,6,6,3,12,4,5,5,6,3,4,4,4,5,
%U A057690 5,4,7,6,4,5,9,5,3,4,4,6,3,8,4,6,5,6,3,5,6,6,8,5,5,6,7,5,5,4,3,4,5,5,5,5,4
%N A057690 Length of cycle in trajectory of P under the 'Px+1' map, where P = n-th prime, or -1 if trajectory does not cycle.
%C A057690 See A057684 for definition.
%C A057690 Note that not all cycles for the iteration starting with p contain the number 1; a(60), for the prime 281, is the first example of this. Its iterates are: 281, 78962, 39481, 3037, 853398, 426699, 142233, 47411, 6773, 521, 146402, 73201, 1031, 289712, 144856, 72428, 36214, 18107, 953, 267794, 133897, with the last 12 terms cycling. Another example is provided by 2543, the 372nd prime. - _T. D. Noe_, Apr 02 2008
%H A057690 Michel Marcus, <a href="/A057690/b057690.txt">Table of n, a(n) for n = 2..10000</a>
%F A057690 a(n) = A023514(n)+1 if the cycle contains the number 1. - _Jon Maiga_, Jan 12 2021
%e A057690 For n=4, P=7: trajectory of 7 is 7, 50, 25, 5, 1, 8, 4, 2, 1, 8, 4, 2, 1, 8, 4, 2, 1, ..., which has maximal term 50, cycle length 4 and there are 4 terms before it enters the cycle.
%t A057690 Px1[p_,n_]:=Catch[For[i=1,i<PrimePi[p],i++,If[Divisible[n,Prime[i]],Throw[n/Prime[i]]]];p*n+1];
%t A057690 Module[{nmax=100,m},Table[Length[m=NestWhileList[Px1[Prime[n],#]&,Prime[n],UnsameQ,All]]-FirstPosition[m,Last[m]][[1]],{n,2,nmax}]] (* _Paolo Xausa_, Dec 11 2023 *)
%o A057690 (PARI) f(m, p) = {forprime(q=2, precprime(p-1), if (! (m % q), return (m/q));); m*p+1;}
%o A057690 a(n) = {my(p=prime(n), x=p, list = List()); listput(list, x); while (1, x = f(x, p); for (i=1, #list, if (x == list[i], return (#list - i + 1));); listput(list, x););} \\ _Michel Marcus_, Jan 12 2021
%o A057690 (Python)
%o A057690 from sympy import prime, primerange
%o A057690 def a(n):
%o A057690     P = prime(n)
%o A057690     x, plst, traj, seen = P, list(primerange(2, P)), [], set()
%o A057690     while x not in seen:
%o A057690         traj.append(x)
%o A057690         seen.add(x)
%o A057690         x = next((x//p for p in plst if x%p == 0), P*x+1)
%o A057690     return len(traj) - traj.index(x)
%o A057690 print([a(n) for n in range(2, 107)]) # _Michael S. Branicky_, Dec 11 2023
%Y A057690 Cf. A057446, A057216, A057522, A057534, A057614. See also A033478, A057688, A057684, A057685, A057686, A057687, A057689, A057691.
%Y A057690 Cf. A023514.
%K A057690 nonn,nice,easy
%O A057690 2,1
%A A057690 _N. J. A. Sloane_, Oct 20 2000
%E A057690 More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000
%E A057690 Corrected by _T. D. Noe_, Apr 02 2008