login
A089706
Largest n-digit prime 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).
1
71, 751, 9721, 79531, 978521, 7979771, 97979771, 997979371, 9997979371, 79997979521, 979997978551, 7979997979571, 97979997979771, 997979997978571, 9997979997978571, 79997979997979731, 979997979997978531
OFFSET
2,1
EXAMPLE
a(6) = 420221.
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:=[7, 5, 3, 2]:c:=[9, 8, 6, 4, 0]: cf:=[9, 8, 6, 4]: ctpr:=proc(n, s) local m, T, a: a:=s: m:=1: T:=cartprod([seq(piecewise(isprime(n-i+2), p, i=2, cf, 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]: RETURN(a) fi od: end: a:=[]: for n from 2 to 22 do a:=ctpr(n, a) od: op(a); # C. Ronaldo
CROSSREFS
Sequence in context: A142674 A112750 A351896 * A220623 A173806 A253683
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Nov 10 2003
EXTENSIONS
More terms from C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 25 2004
STATUS
approved