A235620 Primes whose base-9 representation also is the base-8 representation of a prime.
2, 3, 5, 7, 19, 41, 59, 97, 109, 131, 151, 277, 331, 347, 457, 491, 541, 547, 577, 601, 739, 761, 811, 829, 977, 997, 1031, 1231, 1279, 1303, 1321, 1499, 1549, 1571, 1609, 1621, 1801, 1987, 2221, 2239, 2269, 2309, 2381, 2399, 2521, 2617, 2687, 2707, 2791, 2939, 2953, 3119
Offset: 1
Examples
19 is a term: 19 = 21_9 and 21_8 = 17, also a prime. 79 is not a term: 79 = 87_9 and 87 is not a valid base-8 representation.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000
- M. F. Hasler, Primes whose base c expansion is also the base b expansion of a prime
Crossrefs
Programs
-
Mathematica
b9b8pQ[n_]:=Module[{id=IntegerDigits[n,9]},Max[id]<8&&PrimeQ[FromDigits[ id,8]]]; Select[Prime[Range[500]],b9b8pQ] (* Harvey P. Dale, Mar 12 2018 *)
-
PARI
is(p,b=8,c=9)=vecmax(d=digits(p,c))
-
PARI
forprime(p=1,3e3,is(p,9,8)&&print1(vector(#d=digits(p,8),i,9^(#d-i))*d~,",")) \\ To produce the terms, this is more efficient than to select them using straightforwardly is(.)=is(.,8,9)
-
PARI
isok(p) = isprime(p) && (q = digits(p, 9)) && (vecmax(q) < 8) && isprime(fromdigits(q, 8)); \\ Michel Marcus, Mar 12 2018
Comments