cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A384306 Primes whose sum of digits in both base 8 and base 10 are recursively prime down to 2, 3, 5, or 7.

This page as a plain text file.
%I A384306 #44 Jun 10 2025 12:25:36
%S A384306 2,3,5,7,131,311,887,1013,1949,2399,2621,2957,3251,3323,3701,4289,
%T A384306 4919,4973,5099,5101,5477,5927,5981,6359,6599,6779,6863,8069,8447,
%U A384306 8573,8627,8669,8951,9677,10141,10181,10211,10589,10631,11399,11597,12101,12479,12659,12983
%N A384306 Primes whose sum of digits in both base 8 and base 10 are recursively prime down to 2, 3, 5, or 7.
%C A384306 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}.
%H A384306 Alois P. Heinz, <a href="/A384306/b384306.txt">Table of n, a(n) for n = 1..11089</a> (first 1635 terms from Jean-Louis Lascoux)
%e A384306 a(5) = 131:
%e A384306 In base 8: 131 = 203_8 -> 2+0+3 = 5 -> 5 is prime -> ends in 5.
%e A384306 In base 10: 1+3+1 = 5 -> 5 is prime -> ends in 5.
%e A384306 All intermediate values for both bases are primes, and the last values are in {2,3,5,7}.
%e A384306 a(6) = 887:
%e A384306 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.
%e A384306 In base 10: 8+8+7 = 23 -> 23 is prime -> 2+3 = 5 -> 5 is prime -> ends in 5.
%e A384306 All intermediate values for both bases are primes, and the last values are in {2,3,5,7}.
%p A384306 q:= (n, k)-> isprime(n) and (n<k or q(add(i, i=convert(n, base, k)), k)):
%p A384306 select(x-> q(x, 8) and q(x, 10), [$1..20000])[];  # _Alois P. Heinz_, May 27 2025
%o A384306 (PARI) isokb(p,b) = while(1, my(s=sumdigits(p, b)); if (! isprime(s), return(0)); if (s<b, return(1)); p = s;);
%o A384306 isok(p) = isprime(p) && isokb(p,10) && isokb(p,8); \\ _Michel Marcus_, May 27 2025
%o A384306 (Python)
%o A384306 from gmpy2 import digits, is_prime
%o A384306 def rp(n, b): return is_prime(n) and (n < b or rp(sum(map(int, digits(n, b))), b))
%o A384306 def ok(n): return rp(n, 10) and rp(n, 8)
%o A384306 print([k for k in range(2, 13000) if ok(k)]) # _Michael S. Branicky_, May 27 2025
%Y A384306 Subsequence of A070027.
%Y A384306 Cf. A000040, A007953.
%K A384306 nonn,base
%O A384306 1,1
%A A384306 _Jean-Louis Lascoux_, May 25 2025