A386004 Primes whose digit set intersects the odd digits in at most one element and intersects the even digits in at most two elements.
2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89, 101, 181, 211, 223, 227, 229, 233, 241, 263, 269, 277, 281, 283, 383, 401, 409, 421, 433, 443, 449, 461, 463, 467, 487, 499, 601, 607, 641, 643, 647, 661, 677, 683, 727, 787, 809, 811, 821, 823, 827, 829, 863
Offset: 1
Examples
101 is a term because it is prime and its digit set is {0, 1} — containing at most one odd digit and no more than two distinct even digits. 1021 is a term because it is prime and its digit set is {0,1,2} — containing at most one odd digit and no more than two distinct even digits.
Programs
-
Mathematica
Select[Prime[Range[150]],Length[Intersection[d=IntegerDigits[#],{1,3,5,7,9}]]<=1 && Length[Intersection[d,{0,2,4,6,8}]]<=2 &] (* Stefano Spezia, Jul 14 2025 *)
-
PARI
is(n) = if(!isprime(n), return(0)); my(s=Set(digits(n)), odd=0); if(#s>3,return(0)); odd=sum(i=1, #s ,bitand(s[i], 1)); if(odd > 1, return(0)); if(#s-odd > 2, return(0)); 1 \\ David A. Corneth, Jul 14 2025
Comments