login
A089704
Primes in which the unit place digit is 1 and the k-th most significant digit is prime (2,3,5,7) if k is prime else is composite (4,6,8,9,0).
3
31, 71, 251, 271, 331, 521, 571, 751, 4231, 4271, 4721, 4751, 6221, 6271, 6521, 6551, 6571, 8221, 8231, 8521, 8731, 9221, 9371, 9521, 9551, 9721, 20231, 20521, 20551, 20731, 20771, 24251, 24371, 24551, 24571, 26251, 26321, 26371, 26731, 28351
OFFSET
1,1
LINKS
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
Cf. A089705.
Sequence in context: A331260 A127345 A127346 * A287609 A210548 A146353
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