login
Primes without {1, 5} as digits.
1

%I #10 Jul 19 2025 21:41:28

%S 2,3,7,23,29,37,43,47,67,73,79,83,89,97,223,227,229,233,239,263,269,

%T 277,283,293,307,337,347,349,367,373,379,383,389,397,409,433,439,443,

%U 449,463,467,479,487,499,607,643,647,673,677,683,709,727,733,739,743,769

%N Primes without {1, 5} as digits.

%H Jason Bard, <a href="/A386331/b386331.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Pri#PrimesWithDigits">Index to entries for primes with digits in a given set</a>

%p f:= n-> (l-> add([0, $2..4, $6..9][l[j]+1]*10^(j-1), j=1..nops(l)))(convert(n, base, 8)):

%p select(isprime, [seq(f(i), i=0..600)])[]; # _Alois P. Heinz_, Jul 19 2025

%t Select[Prime[Range[120]], DigitCount[#, 10, 1] == 0 && DigitCount[#, 10, 5] == 0 &]

%o (Magma) [p: p in PrimesUpTo(10^6) | Set(Intseq(p)) subset [0, 2, 3, 4, 6, 7, 8, 9]];

%o (Python) print(list(islice(primes_with("02346789"), 41))) # uses function/imports in A385776

%o (PARI) primes_with(, 1, [0, 2, 3, 4, 6, 7, 8, 9]) \\ uses function in A385776

%Y Intersection of A038603 and A038613.

%Y Cf. A000040, A020453, A385776.

%K nonn,base,easy

%O 1,1

%A _Jason Bard_, Jul 19 2025