OFFSET
1,1
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
6271 is a member as unit place digit is 1, second MSD is prime, third MSD is prime and the fourth MSD is composite.
MAPLE
with(combinat, cartprod): ds:=proc(s) local j, l: l:=nops(s): RETURN(add(s[j]*10^(l-j), j=1..l)):end: p:=[2, 3, 5, 7]:c:=[0, 4, 6, 8, 9]: ctpr:=proc(n, s) local m, T, a: a:=s: m:=1: T:=cartprod([seq(piecewise(isprime(n-i+2), p, c), i=2..n), [1]]): while not T[finished] do m:=ds(T[nextvalue]()): if isprime(m) and not member(m, a) then a:=[op(a), m] fi od: RETURN(a): end: a:=[]: for n from 1 to 5 do a:=ctpr(n, a) od: op(a); # C. Ronaldo
MATHEMATICA
rdQ[n_]:=Module[{ridn=Reverse[IntegerDigits[n]]}, Total[Which[#[[1]]==#[[2]] == 1, 1, AllTrue[#, PrimeQ], 1, AllTrue[#, CompositeQ], 1, CompositeQ[#[[2]]] && #[[1]] == 0, 1, True, 0]&/@Table[{ridn[[k]], k}, {k, Length[ ridn]}]] == Length[ ridn]]; Select[Prime[Range[3100]], rdQ] (* Harvey P. Dale, Jan 17 2021 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Nov 10 2003
EXTENSIONS
More terms from C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 25 2004
Offset changed by Andrew Howroyd, Sep 17 2024
STATUS
approved