This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A073754 #27 Dec 17 2024 22:42:36 %S A073754 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, %T A073754 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, %U A073754 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 %N 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. %H A073754 Sean A. Irvine, <a href="/A073754/b073754.txt">Table of n, a(n) for n = 2..1000</a> %e A073754 For n=9, a(9)=3 because 9 -> 16 -> 35 -> 67 %t A073754 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 *) %o A073754 (UBASIC) %o A073754 10 cls %o A073754 30 for I=2 to 100 %o A073754 32 H=I %o A073754 40 if odd(H)=1 then goto 90 else goto 50 %o A073754 50 A=2*H+alen(H)+1:K=K+1 %o A073754 60 if prmdiv(A)=A then print I,K:goto 120 %o A073754 65 if K>1000 then print I,0:goto 120 %o A073754 70 H=A:goto 40 %o A073754 90 A=2*H-alen(H)-1:K=K+1 %o A073754 100 if prmdiv(A)=A then print I,K:goto 120 %o A073754 105 if K>1000 then print I,0:goto 120 %o A073754 110 H=A:goto 40 %o A073754 120 K=0 %o A073754 130 next %K A073754 easy,nonn,base %O A073754 2,1 %A A073754 _Felice Russo_, Sep 02 2002 %E A073754 More terms from _Jason Earls_, Sep 04 2002