A278698 Primes p such that every suffix of the base-5 representation of p is either a prime or 1.
2, 3, 7, 11, 13, 17, 23, 53, 61, 67, 73, 101, 103, 107, 113, 127, 251, 257, 263, 311, 317, 353, 503, 523, 601, 607, 613, 1303, 1567, 1753, 1877, 2503, 3023, 6257, 6263, 6311, 6317, 6323, 6353, 6857, 6863, 7817, 8753, 9377, 12503, 12511, 12517, 12553, 12601, 12613, 12757
Offset: 1
Examples
61=221_5 is in the sequence since it is a prime and each of its base-5 suffixes (21_5=11 and 1_5=1) is either prime or 1.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Programs
-
PARI
expand(v,d)=my(u=List(v), D=5^d); forstep(x=D,4*D,D, for(i=1,#v, if(isprime(t=x+v[i]), listput(u,t)))); Vec(u) list(lim)=my(v=[1,2,3]); for(n=1,#digits(lim\=1,5)-1, v=expand(v,n)); select(k->k<=lim && k>1, v) \\ Charles R Greathouse IV, Nov 26 2016
-
PARI
isok(n) = {if (isprime(n), pp = 5^logint(n, 5); while ((isprime(rem=(n % pp)) || (rem == 1)) && (pp != 1), pp = pp/5); pp == 1;);} \\ Michel Marcus, Nov 26 2016