OFFSET
1,1
COMMENTS
A prime p belongs to this sequence if in both bases 8 and 10 the iterative digit-sum process yields only prime values down to one of {2, 3, 5, 7}.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..11089 (first 1635 terms from Jean-Louis Lascoux)
EXAMPLE
a(5) = 131:
In base 8: 131 = 203_8 -> 2+0+3 = 5 -> 5 is prime -> ends in 5.
In base 10: 1+3+1 = 5 -> 5 is prime -> ends in 5.
All intermediate values for both bases are primes, and the last values are in {2,3,5,7}.
a(6) = 887:
In base 8: 887 = 1567_8 -> 1+5+6+7 = 19 -> 19 is prime -> 19 = 23_8 -> 2+3 = 5-> 5 is prime -> ends in 5.
In base 10: 8+8+7 = 23 -> 23 is prime -> 2+3 = 5 -> 5 is prime -> ends in 5.
All intermediate values for both bases are primes, and the last values are in {2,3,5,7}.
MAPLE
q:= (n, k)-> isprime(n) and (n<k or q(add(i, i=convert(n, base, k)), k)):
select(x-> q(x, 8) and q(x, 10), [$1..20000])[]; # Alois P. Heinz, May 27 2025
PROG
(PARI) isokb(p, b) = while(1, my(s=sumdigits(p, b)); if (! isprime(s), return(0)); if (s<b, return(1)); p = s; );
isok(p) = isprime(p) && isokb(p, 10) && isokb(p, 8); \\ Michel Marcus, May 27 2025
(Python)
from gmpy2 import digits, is_prime
def rp(n, b): return is_prime(n) and (n < b or rp(sum(map(int, digits(n, b))), b))
def ok(n): return rp(n, 10) and rp(n, 8)
print([k for k in range(2, 13000) if ok(k)]) # Michael S. Branicky, May 27 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jean-Louis Lascoux, May 25 2025
STATUS
approved
