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

f.firoozbakht at sci.ui.ac.ir f.firoozbakht at sci.ui.ac.ir
Tue Feb 10 13:28:57 CET 2009

```Dear Neil,

Note that the offset equals to 1.

The first 39 terms of the sequence are:

1, 2, 3, 6, 4, 31, 7, 55, 4, 33, 5, 30, 32, 1, 4, 19, 8, 112, 56, 16, 27,
4, 4, 26, 2, 20, 223, 102, 34, 14, 6, 162, 2, 9, 10, 75, 31, 113, 21

So a(18)=112 but I changed the bob's program a bit to finding correct terms
as follows.

f[n_] := If[n==1,1,FromDigits@ Flatten[ IntegerDigits@# & /@ (PrimePi@#
& /@ Flatten[ Table[ First@#, {Last@#}] & /@ FactorInteger at n])]];
g[n_] := Length@ NestWhileList[f, n, UnsameQ, All] - 1; Array[g, 39]

-- Farideh

Quoting "N. J. A. Sloane" <njas at research.att.com>:

> I have now had a chance to study A098282 further.
>
> While it is still true that I don't quite agree with Bob Wilson's results,
> it is very impressive that he extended the sequence through a(39).
> In particular, he finds that a(18) = 112, which I have now
> confirmed using Maple but calling on Mma for help when Maple
> couldn't compute some values of pi (Mma's PrimePi).
>
> The first time Maple ran into trouble was at the 38th step
> of the trajectory of 18.
> Maple can't compute pi(544768069) (at least not in 10 minutes),
> whereas Mma finds
> In[7]:= PrimePi[544768069]
> Out[7]= 28585125
> instantly  (this is Maple 11 vs Mma 7)
>
> Bob's Mma program is the following:
>
> 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]
>
> This is opaque to me, but obviously is better that the Maple programs
> I've seen.
>
> The results Bob found were:
>
> 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,103,34,14,7,163,2,10,11,76,31,114,22
>
> As I said, I don't quite agree with this, since the correct values
> for the first 18 terms using my definition are
>
> 1,2,3,6,4,31,7,55,4,33,5,30,32,1,4,19,8,112
>
> I'm not too confident of the 18th term, 112, since
> it was done by hand, using a mixture of Maple and Mma.
> But I am confident of all the other values,
> since they were found by our Maple program in A098282.
>
> I wonder if someone (Bob, perhaps?) could modify the Mma
> program so that it reproduces my values
> and then extends them out to 39 terms or more?
>
> Neil
>

----------------------------------------------------------------
University of Isfahan (http://www.ui.ac.ir)

```