OFFSET
2,1
LINKS
Sean A. Irvine, Table of n, a(n) for n = 2..1000
EXAMPLE
For n=9, a(9)=3 because 9 -> 16 -> 35 -> 67
MATHEMATICA
pa[n_] := If[EvenQ[n], 2*n + IntegerLength[n] + 1, 2*n - IntegerLength[n] - 1]; Table[c = 0; If[PrimeQ[n], n = pa[n]; c = 1]; While[! PrimeQ[n] && c < 1000, n = pa[n]; c += 1]; If[c == 1000, c = -1]; c, {n, 2, 92}] (* Jayanta Basu, Jul 09 2013 *)
PROG
(UBASIC)
10 cls
30 for I=2 to 100
32 H=I
40 if odd(H)=1 then goto 90 else goto 50
50 A=2*H+alen(H)+1:K=K+1
60 if prmdiv(A)=A then print I, K:goto 120
65 if K>1000 then print I, 0:goto 120
70 H=A:goto 40
90 A=2*H-alen(H)-1:K=K+1
100 if prmdiv(A)=A then print I, K:goto 120
105 if K>1000 then print I, 0:goto 120
110 H=A:goto 40
120 K=0
130 next
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Felice Russo, Sep 02 2002
EXTENSIONS
More terms from Jason Earls, Sep 04 2002
STATUS
approved
