login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A111462
a(1) = 7, then smallest prime beginning with the digit reversal of the previous term.
2
7, 71, 17, 719, 9173, 3719, 91733, 3371947, 7491733, 33719479, 974917337, 73371947923, 3297491733763, 367337194792327, 72329749173376301, 1036733719479232777, 777232974917337630173, 37103673371947923277727
OFFSET
1,1
EXAMPLE
a(3) = 17 because a(2) = 71 and the digit reversal of 71 is 17 which is prime
a(4) = 719 because a(3) = 17, digit reversal of 17 is 71 which is already in the list. Smallest prime that starts with 71 is 719.
MAPLE
reverse := proc (nn) local n, m; m := 0; n := nn; while (n > 0) do m := m*10 + irem(n, 10, 'n'); od; m; end:
a := proc(n, m) option remember; global currSet; local currN, i, origN, j; if n = 0 then currSet := {m}; return m; end if; currN := reverse(a(n - 1, m)); if (not (evalb(currN in currSet))) then if (isprime(currN)) then currSet := currSet union {currN}; return currN; end if; end if; origN := currN; j := 1; while (true) do origN := 10 * origN; currN := origN; i := 0; while i < (10^j) do if (isprime(currN) and (not evalb(currN in currSet))) then currSet := currSet union {currN}; return currN; end if; currN := currN + 1; i := i + 1; end do; j := j + 1; end do; return currN; end proc; (Delgau)
CROSSREFS
Sequence in context: A097630 A090647 A200929 * A045713 A090155 A326740
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Aug 04 2005
EXTENSIONS
More terms from Chris Deugau (deugaucj(AT)uvic.ca), Nov 07 2005
STATUS
approved