%I #33 Sep 08 2022 08:44:45
%S 11,41,4111,4441,11411,14411,41141,41411,44111,1114111,1144141,
%T 1144441,1411141,1411411,1441411,1444111,1444411,1444441,4141441,
%U 4414411,4441111,4441441,11111141,11141111,11141441,11441141,11441411,14111441,14141411
%N Primes that contain digits 1 and 4 only.
%H Alois P. Heinz, <a href="/A020452/b020452.txt">Table of n, a(n) for n = 1..20000</a> (first 1000 terms from Vincenzo Librandi)
%H James Maynard and Brady Haran, <a href="https://www.youtube.com/watch?v=eeoBCS7IEqs">Primes without a 7</a>, Numberphile video (2019).
%t Flatten[Table[Select[FromDigits/@Tuples[{1,4},n],PrimeQ],{n,8}]] (* _Vincenzo Librandi_, Jul 27 2012 *)
%o (Magma) [p: p in PrimesUpTo(14141411) | Set(Intseq(p)) subset [1,4]]; // _Bruno Berselli_, Jul 27 2012
%o (Python)
%o from sympy import primerange
%o def checkd(a, c):
%o b = set(int(i) for i in set(str(a)))
%o return b.issubset(c)
%o for n in primerange(2, 2000000):
%o if checkd(n, [1, 4]):
%o print(n)
%o # _Abhiram R Devesh_, May 08 2015
%Y Cf. A032822.
%K nonn,base
%O 1,1
%A _David W. Wilson_
|