OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
PROG
(C++)
#include <iostream>
using namespace std;
bool isPrime(long n)
{
if(n==0) return true;
for(long i = 2; i<=n/2; i++) { if(n%i == 0) return false; }
return true;
}
bool checkdigit(long n)
{
long no = n;
while(no>0)
{
long digit = no%10;
if(digit==0) return false;
else { if(!isPrime (digit)) return false; }
no = no/10;
}
return true;
}
int main()
{
long limit = 1000000000; int count =0;
for(long i=1; i<=limit; i++)
{
if(isPrime(i) && checkdigit(i))
{ count++; cout<<i<<endl; }
if(count == 100) { return 0; }
}
return 0;
}
(Python)
from sympy import isprime
def ok(n): return n == 1 or (set(str(n)) <= set("012357") and isprime(n))
print([m for m in range(1032) if ok(m)]) # Michael S. Branicky, Jan 25 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Mohit Singh Kanwal (mohit_kanwal(AT)hotmail.com), May 10 2009
STATUS
approved