login
a(1) = 7, then smallest prime beginning with the digit reversal of the previous term.
2

%I #3 Dec 05 2013 19:57:05

%S 7,71,17,719,9173,3719,91733,3371947,7491733,33719479,974917337,

%T 73371947923,3297491733763,367337194792327,72329749173376301,

%U 1036733719479232777,777232974917337630173,37103673371947923277727

%N a(1) = 7, then smallest prime beginning with the digit reversal of the previous term.

%e a(3) = 17 because a(2) = 71 and the digit reversal of 71 is 17 which is prime

%e 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.

%p reverse := proc (nn) local n,m; m := 0; n := nn; while (n > 0) do m := m*10 + irem(n,10,'n'); od; m; end:

%p 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)

%Y Cf. A111463, A090543.

%K base,nonn

%O 1,1

%A _Amarnath Murthy_, Aug 04 2005

%E More terms from Chris Deugau (deugaucj(AT)uvic.ca), Nov 07 2005