login
Primes which contain the digit 2 or the digit 3.
0

%I #9 Apr 03 2023 10:36:11

%S 2,3,13,23,29,31,37,43,53,73,83,103,113,127,131,137,139,163,173,193,

%T 211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,

%U 311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,421,431,433

%N Primes which contain the digit 2 or the digit 3.

%H Chris Caldwell, <a href="https://t5k.org/lists/small/1000.txt">The First 1000 primes</a>.

%p a:=proc(n) local nn: nn:=convert(convert(n,base,10),set): if isprime(n)=true and 0 < nops(`intersect`({2, 3},nn)) then n else end if end proc: seq(a(n),n= 1..400); # _Emeric Deutsch_, Mar 31 2008

%t fQ[n_] := Block[{id = IntegerDigits@ n}, MemberQ[id, 2] || MemberQ[id, 3]]; Select[ Prime@ Range@ 84, fQ@ # &] (* _Robert G. Wilson v_, Apr 19 2008 *)

%Y Cf. A137238, A133765.

%K nonn,base,easy

%O 1,1

%A _Parthasarathy Nambi_, Mar 17 2008

%E Corrected and extended by _Emeric Deutsch_, Mar 31 2008