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

Robert G. Wilson, v rgwv at rgwv.com
Mon Feb 9 17:10:16 CET 2009

```Neil,

I submitted this a week ago. Not knowing the code for A098282 I am
not in a
position of resolve the differences. But somehow my sequence is still
not recorded.

Bob.

%I A000001
%S A000001
2,3,4,7,5,31,8,55,4,33,6,30,32,1,4,20,9,113,56,16,28,4,4,27,2,21,224,
%T A000001 103,34,14,7,163,2,10,11,76,31,114,22
%N A000001 Number of iterations to repeat a term.
%C A000001 From an idea by Eric Angelini (Eric.Angelini at kntv.be) in the
seqfan blog dtd. Jan 31, 2009.
%t A000001 f[n_] := FromDigits@ Flatten[ IntegerDigits@# & /@ (PrimePi@#
& /@ Flatten[ Table[ First@#, {Last@#}] & /@ FactorInteger at n])]; g[n_]
:= Length@ NestWhileList[f, n, UnsameQ, All] - 1; Array[g, 39]
%Y A000001 Cf. A000040
%K A000001 nonn
%O A000001 1,1
%A A000001 Robert G. Wilson v (rgwv at rgwv.com), Jan 31 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).

N. J. A. Sloane wrote:

>Eric, Jacques, Seqfans:
>
>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).
>
>
>
>_______________________________________________
>
>Seqfan Mailing list - http://list.seqfan.eu/
>
>
>

```