OFFSET
1,1
COMMENTS
If the number doesn't end in 1, 3, 7 or 9, then the prepending requirement is automatically satisfied. Hence it becomes nonrestrictive and not very interesting.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..4000
EXAMPLE
The definition means that 891, 1891, 2891, 3891, 4891, 5891, 6891, 7891, 8891, 9891, 8911, 8913, 8917 and 8919 are all composite numbers.
MATHEMATICA
dppQ[n_]:=AllTrue[Join[{n}, Table[m*10^IntegerLength[n]+n, {m, 9}], Table[ n*10+k, {k, {1, 3, 7, 9}}]], CompositeQ]; Select[Range[8000], MemberQ[ {1, 3, 7, 9}, Mod[ #, 10]]&&dppQ[#]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 19 2018 *)
PROG
(Python)
from sympy import isprime
def ok(n):
s = str(n)
if s[-1] not in "1379": return False
if any(isprime(int(s+c)) for c in "1379"): return False
return not any(isprime(int(c+s)) for c in "0123456789")
print([k for k in range(7114) if ok(k)]) # Michael S. Branicky, Aug 02 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Tanya Khovanova, Dec 23 2006
STATUS
approved