[seqfan] Re: Rank of a prime (Collatz/Syracuse)

N. J. A. Sloane njas at research.att.com
Mon Feb 9 06:16:55 CET 2009


Eric, Jacques, Seqfans:

There were some postings about this a week ago, 
which led me to add the following two entries to the OEIS - 
Eric, is that OK?

Neil

%I A087712
%S A087712 1,1,2,11,3,12,4,111,22,13,5,112,6,14
%N A087712 a(1) = 1; if n = k-th prime, a(n) = k; otherwise write all prime factors of n in nondecreasing order, replace each prime by its rank, and concatenate the ranks.
%C A087712 The old entry with this A-number was a duplicate of A082467.
%O A087712 1,3
%K A087712 nonn,base,more
%Y A087712 See A098282 for lengths of trajectories.
%e A087712 n = 2 = first prime, a(2) = 1.
%e A087712 n = 3 = second prime, a(3) = 2.
%e A087712 n = 4 = 2*2 -> 1,1 -> 11, so a(4) = 11.
%e A087712 n = 6 = 2*3 -> 1,2 -> 12, so a(6) = 12.
%e A087712 n = 12 = 2*2*3 -> 1,1,2 -> 112, so a(12) = 112.
%A A087712 Eric Angelini (Eric.Angelini(AT)kntv.be), Feb 02 2009

%I A098282
%S A098282 1,2,3,6,4,31,7,56,4,34,5
%N A098282 Iterate the map k -> A087712(k) starting at n; a(n) is the number of steps at which we see a repeated term for the first time; or -1 if the trajectory never repeats.
%C A098282 The old entry with this A-number was a duplicate of A030298.
%O A098282 0,2
%K A098282 nonn,base,more
%Y A098282 Cf. A087712, A007097.
%o A098282 (GBnums code from Jacques Tramu (jacques.tramu(AT)echolalie.com)):
%o A098282 void ea (n)
%o A098282 {
%o A098282 mpz u[] ; // factors
%o A098282 mpz tr[]; // sequence
%o A098282 print(n);
%o A098282 while(n > 1)
%o A098282 {
%o A098282 lfactors(u,n); // factorize into u
%o A098282 vmap(u,pi);  // replace factors by rank
%o A098282 n = catv(u); // concatenate
%o A098282 print(n);
%o A098282 if(vsearch(tr,n) > 0) break; // loop found
%o A098282 vpush(tr,n); // remember n
%o A098282 }
%o A098282 println('');
%o A098282 }
%e A098282 3 -> 2 -> 1 -> 1; 3 steps to see a repeat.
%e A098282 4 -> 11 -> 5 -> 3 -> 2 -> 1 -> 1; 6 steps to see a repeat.
%e A098282 6 -> 12 -> 112 -> 11114 -> 1733 -> 270 -> 12223 -> 7128 -> 11122225 -> 33991010 -> 13913661 -> 2107998 -> 12222775 -> 33910130 -> 131212367 -> 56113213 -> 6837229 -> 4201627 -> 266366 -> 112430 -> 131359 -> 7981 -> 969 -> 278 -> 134 -> 119 -> 47 -> 15 -> 23 -> 9 -> 22 -> 15; 31 steps to see a repeat.
%A A098282 Eric Angelini (Eric.Angelini(AT)kntv.be), Feb 02 2009
%E A098282 Jacques Tramu found a(8) and a(10).





More information about the SeqFan mailing list