login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A073754 Number of steps needed to reach a prime when the following map is repeatedly applied to n: if n is even then 2n + #(n) + 1, otherwise 2n - #(n) - 1, where #(n) is the number of digits of n; or -1 is no prime is ever reached. 5
3, 3, 2, 12, 2, 10, 11, 3, 1, 1, 9, 1, 1, 9, 2, 1, 10, 2, 1, 10, 1, 1, 8, 1, 2, 8, 1, 2, 13, 1, 1, 13, 1, 1, 9, 1, 1, 9, 1, 1, 35, 1, 2, 35, 8, 2, 7, 8, 1, 7, 1, 1, 52, 1, 6, 52, 21, 6, 12, 21, 1, 12, 1, 1, 12, 1, 1, 12, 28, 1, 8, 28, 1, 8, 5, 1, 6, 5, 1, 6, 1, 1, 34, 1, 5, 34, 1, 5, 71, 1, 7 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,1
LINKS
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
Sequence in context: A330307 A256916 A164705 * A193229 A112458 A019252
KEYWORD
easy,nonn,base
AUTHOR
Felice Russo, Sep 02 2002
EXTENSIONS
More terms from Jason Earls, Sep 04 2002
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 18 22:56 EDT 2024. Contains 370952 sequences. (Running on oeis4.)