A090709 Primes whose decimal representation is a valid number in base 6 and interpreted as such is again a prime.
2, 3, 5, 11, 31, 101, 151, 211, 241, 251, 331, 421, 431, 521, 1021, 1151, 1231, 1321, 2011, 2131, 2311, 2351, 2441, 2531, 2551, 3041, 3221, 3251, 3301, 3541, 4021, 4111, 4201, 4421, 4441, 4451, 5011, 5021, 5101, 5231, 5441, 5531, 10331, 11131, 11311
Offset: 1
Examples
31 is prime in decimal and a valid number in base 6: 31_6 = 19, a prime.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..10000
Programs
-
Magma
[n:n in PrimesUpTo(12000)| Max(Intseq(n,10)) le 5 and IsPrime(Seqint(Intseq(Seqint(Intseq(n),6))))]; // Marius A. Burtea, Jun 30 2019
-
Mathematica
Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 6], PrimeQ] (* Robert G. Wilson v, Jan 05 2014 *) vn6pQ[n_]:=Module[{idn=IntegerDigits[n]},Max[idn]<6&&PrimeQ[ FromDigits[ idn,6]]]; Select[Prime[Range[1500]],vn6pQ] (* Harvey P. Dale, Jul 10 2015 *)
-
PARI
fixBase(n, oldBase, newBase)=my(d=digits(n, oldBase), t=newBase-1); for(i=1, #d, if(d[i]>t, for(j=i, #d, d[j]=t); break)); fromdigits(d, newBase) list(lim)=my(v=List(), t); forprime(p=2, fixBase(lim\1, 10, 6), if(isprime(t=fromdigits(digits(p, 6), 10)), listput(v, t))); Vec(v) \\ Charles R Greathouse IV, Nov 07 2016
-
Python
from gmpy2 import digits, is_prime A090709_list = [n for n in (int(digits(d,6)) for d in range(10**6) if is_prime(d)) if is_prime(n)] # Chai Wah Wu, Apr 09 2016
Extensions
Following suggestions by V.J. Pohjola and Donovan Johnson, name, example and offset corrected by M. F. Hasler, Jan 03 2014