OFFSET
0,1
LINKS
Carlos Rivera, Puzzle 246. The worm, The Prime Puzzles and Problems Connection.
FORMULA
Select prime numbers having the same first and last digits; if the uniform absolute value of successive digit differences is 2, add to sequence.
EXAMPLE
a(4)=797; first and last digits are 7; abs(7-9)=2; abs(9-7)=2; the worm is 7.
MATHEMATICA
pwQ[n_]:=Module[{idn=IntegerDigits[n]}, First[idn]==Last[idn]&&Union[Abs[ Differences[idn]]]=={2}]; Select[Prime[Range[50000000]], pwQ] (* Harvey P. Dale, Mar 26 2013 *)
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Enoch Haga, Dec 25 2003
STATUS
approved