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.

A138752 Number of iterations before prime(n) reaches 7 or 2 under x -> A007918(A138750(x)).

This page as a plain text file.
%I A138752 #21 Jul 28 2023 15:55:41
%S A138752 0,1,2,0,1,4,2,7,5,3,20,16,6,6,4,4,21,23,19,17,17,15,7,5,7,5,28,22,26,
%T A138752 22,22,20,18,18,16,20,16,14,6,6,8,59,8,8,6,29,27,25,23,25,23,23,27,23,
%U A138752 21,19,19,21,19,17,19,17,19,17,17,15,13,11,9,11,9,60,58,54,11,9,7,30,28
%N A138752 Number of iterations before prime(n) reaches 7 or 2 under x -> A007918(A138750(x)).
%C A138752 As explained in A138751, the map x->A007918(A138750(x)) is a natural generalization of the Collatz map to primes.
%C A138752 The only even prime p=2 is the only fixed point of this map, and all odd primes seem to end up in the loop 7 -> 17 -> 11 -> 7, after a number of steps given in the present sequence.
%C A138752 (It might have been more natural to count the steps until a number is reached for the second time. Depending on which number among {2,7,11,17} is reached first, this would increase the value of a(n) by 1,3,2 resp. 1.)
%H A138752 Paolo Xausa, <a href="/A138752/b138752.txt">Table of n, a(n) for n = 1..10000</a>
%H A138752 Georges Brougnard, <a href="https://web.archive.org/web/20150912085647/http://www.echolaliste.com/gbnums/gb4.jpg">Trajectory of 4499221</a>.
%H A138752 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%e A138752 a(1)=a(4)=0 since prime(1)=2 and prime(4)=7 are by definition the values at which counting ends.
%e A138752 a(primepi(4499221))=63337 according to G. Brougnard, cf. Link.
%t A138752 A138752[n_]:=Length[NestWhileList[NextPrime[If[Mod[#,3]==2,#/2,2#]]&,Prime[n],#!=2&&#!=7&]]-1;Array[A138752,100] (* _Paolo Xausa_, Jul 28 2023 *)
%o A138752 (PARI) A138752(n,c=0) = { if( n==1 & 7==n=prime(n), 0, until( 7==n=nextprime( if( n%3==2, ceil(n/2), 2*n )),c++);c)}
%Y A138752 Cf. A124123, A138750, A138751, A138753.
%K A138752 easy,nonn
%O A138752 1,3
%A A138752 _M. F. Hasler_, Mar 28 2008