OFFSET
1,1
COMMENTS
If a number is in this sequence, then all the numbers with the first digit changed to another nonzero digit are also in this sequence.
Numbers ending in 0, 2, 4, 5, 6, and 8 are not included by definition, because they are composite independently of the other digits.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
1071, 2071, 3071, 4071, 5071, 6071, 7071, 8071 and 9071 are all composite numbers. Thus, all of them are in this sequence.
MAPLE
q:= n-> (l-> l[1] in [1, 3, 7, 9] and andmap(not isprime, [seq(parse
(cat(j, seq(l[-i], i=2..nops(l)))), j=1..9)]))(convert(n, base, 10)):
select(q, [$1..5080])[]; # Alois P. Heinz, Jun 29 2021
MATHEMATICA
Select[Range[1, 6000, 2], Take[IntegerDigits[#], -1] != {5} && CompositeQ[Table[FromDigits[Prepend[Rest[IntegerDigits[#]], n]], {n, 9}]] == {True, True, True, True, True, True, True, True, True} &]
Select[Range[1, 5100, 2], NumberDigit[#, 0]!=5&&NoneTrue[FromDigits/@Table[ PadRight[ {d}, IntegerLength[#], IntegerDigits[#]], {d, 9}], PrimeQ]&] (* Harvey P. Dale, Sep 24 2021 *)
PROG
(Python)
from sympy import isprime
def ok(n):
if n < 10 or n%10 not in {1, 3, 7, 9}: return False
s = str(n)[1:]
return all(not isprime(int(d+s)) for d in "123456789")
print(list(filter(ok, range(1, 6000, 2)))) # Michael S. Branicky, Jun 29 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Tanya Khovanova, Jun 29 2021
STATUS
approved