A279366 Primes whose proper substrings of consecutive digits are all composite.
89, 449, 499, 4649, 4969, 6469, 6869, 6949, 8669, 8699, 8849, 9649, 9949, 44699, 46649, 48649, 48869, 49669, 64849, 84869, 86969, 88469, 94849, 94949, 98869, 99469, 444469, 444869, 446969, 466649, 468869, 469849, 469969, 494699, 496669, 496849, 498469, 644669
Offset: 1
Examples
44699 is in the sequence because 4, 6, 9, 44, 46, 69, 99, 446, 469, 669, 4469 and 4699 are composite numbers. However, 846499 is not included because 4649 is prime.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 63 terms from Rodrigo de O. Leite)
Programs
-
Mathematica
Select[Prime@ Range[5, 10^5], Function[n, Times @@ Boole@ Map[CompositeQ, Flatten@ Map[FromDigits /@ Partition[n, #, 1] &, Range[Length@ n - 1]]] == 1]@ IntegerDigits@ # &] (* Michael De Vlieger, Dec 10 2016 *) Select[Flatten[Table[FromDigits/@Tuples[{4,6,8,9},d],{d,6}]],PrimeQ[#]&&AllTrue[ FromDigits /@ Union[Flatten[Table[Partition[IntegerDigits[#],n,1],{n,IntegerLength[#]-1}],1]], CompositeQ]&] (* Harvey P. Dale, Jul 15 2023 *)
-
Python
from sympy import isprime from itertools import count, islice, product def ok(n): s = str(n) if set(s) & {"1", "2", "3", "5", "7"} or not isprime(n): return False ss2 = set(s[i:i+l] for i in range(len(s)-1) for l in range(2, len(s))) return not any(isprime(int(ss)) for ss in ss2) def agen(): for d in count(2): for p in product("4689", repeat=d-1): t = int("".join(p)+"9") if ok(t): yield t print(list(islice(agen(), 38))) # Michael S. Branicky, Oct 07 2022
Comments