login
A032734
All 81 combinations of prefixing and following a(n) by a single digit are nonprime.
7
2437, 5620, 7358, 11111, 13308, 13332, 13650, 14612, 19737, 19817, 24217, 25213, 26302, 27971, 28472, 28838, 29289, 29542, 29650, 31328, 33027, 33170, 35914, 35970, 36186, 37977, 38327, 39127, 39608, 40078, 41165, 41528, 42422, 43277, 44657, 45649, 47172, 47382
OFFSET
1,1
EXAMPLE
2437 prefixed and followed with a pair of digits from (1,2,3,4,5,6,7,8,9) never yields a prime, e.g., '9'2437'1' = 7 * 37 * 43 * 83.
MAPLE
isA032734 := proc(n)
for k from 1 to 9 do
for k2 from 1 to 9 do
dgs := [k, op(convert(n, base, 10)), k2] ;
dgsn := add( op(i, dgs)*10^(i-1), i=1..nops(dgs)) ;
if isprime(dgsn) then
return false;
end if;
end do:
end do:
return true;
end proc:
for n from 1 to 50000 do
if isA032734(n) then
printf("%d, ", n);
end if;
end do: # R. J. Mathar, Oct 22 2011
filter:= proc(n) local d, i, j;
d:= 10^(ilog10(n)+2);
not ormap(isprime, [seq(seq(d*i+10*n+j, j=[1, 3, 5, 7, 9]), i=1..9)])
end proc:
select(filter, [$1..10^5]); # Robert Israel, Jul 07 2016
MATHEMATICA
ok[n_] := With[{id = IntegerDigits[n]}, Select[ Flatten[ Table[ FromDigits[ Join[{j}, id, {k}]], {j, 1, 9}, {k, 1, 9}], 1], PrimeQ, 1] == {}]; A032734 = {}; n = 1; While[n < 50000, If[ok[n], Print[n]; AppendTo[A032734, n]]; n++]; A032734(* Jean-François Alcover, Nov 23 2011 *)
Select[Range[50000], NoneTrue[Flatten[Table[FromDigits[Join[{x}, IntegerDigits[ #], {y}]], {x, 9}, {y, 9}]], PrimeQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Apr 07 2018 *)
PROG
(PARI) is_A032734(n)=p=10^#Str(n*=10); forstep(k=n+p, n+9*p, p, nextprime(k)>k+9 || return); 1 \\ M. F. Hasler, Oct 22 2011
(Python)
from sympy import isprime
def ok(n):
s, fdigs, edigs = str(n), "123456789", "1379"
return not any(isprime(int(f+s+e)) for f in fdigs for e in edigs)
print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Sep 05 2022
CROSSREFS
KEYWORD
nonn,nice,base
AUTHOR
Patrick De Geest, May 15 1998
STATUS
approved