

A090009


Begins the earliest lengthn chain of primes such that any term in the chain equals the previous term increased by the sum of its digits.


3




OFFSET

1,1


LINKS

Table of n, a(n) for n=1..9.
Carlos Rivera, Puzzle 163. P+SOD(P)


EXAMPLE

11 begins the earliest chain 11, 13, 17 of three primes such that any term in the chain equals the previous term increased by the sum of its digits, viz., 13 = 11 + 2, 17 = 13 + 4. Hence a(3) = 11.


MAPLE

with(numtheory);
A090009:=proc(q)
local a, b, c, d, j, n;
d:=0;
for n from 1 to q do
a:=0; c:=ithprime(n); j:=c;
while isprime(c) do
a:=a+1; b:=0; while c>0 do b:=b+(c mod 10); c:=trunc(c/10); od;
c:=j+b; j:=c; od;
if a=d+1 then d:=a; lprint(d, ithprime(n)); j:=1;
else if a>d+1 then for j from 1 to ad do lprint(d+j, ithprime(n)); od; d:=a;
fi; fi; od; end:
A090009(10000000000); # Paolo P. Lava, Jun 07 2012


CROSSREFS

Sequence in context: A168413 A153705 A245521 * A153706 A201187 A068225
Adjacent sequences: A090006 A090007 A090008 * A090010 A090011 A090012


KEYWORD

base,more,nonn


AUTHOR

Joseph L. Pe, Jan 27 2004


EXTENSIONS

a(7)a(8) from Donovan Johnson, Jan 08 2013
a(9) from Giovanni Resta, Jan 14 2013


STATUS

approved



