login
A345904
Numbers ending in 1, 3, 7 or 9 that yield no primes if their first digit is changed to another nonzero digit.
1
1071, 1149, 1183, 1401, 1509, 1611, 1771, 1773, 1809, 1891, 1921, 2071, 2149, 2183, 2401, 2509, 2611, 2771, 2773, 2809, 2891, 2921, 3071, 3149, 3183, 3401, 3509, 3611, 3771, 3773, 3809, 3891, 3921, 4071, 4149, 4183, 4401, 4509, 4611, 4771, 4773, 4809, 4891, 4921, 5071
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
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
Subsequence of A045572.
Sequence in context: A252569 A020386 A236870 * A252256 A345525 A345779
KEYWORD
nonn,base
AUTHOR
Tanya Khovanova, Jun 29 2021
STATUS
approved