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.

A355034 a(n) is the least base b >= 2 where the sum of digits of n is a prime number.

This page as a plain text file.
%I A355034 #10 Jun 18 2022 08:41:50
%S A355034 3,2,3,2,2,2,4,2,2,2,2,2,2,3,8,2,2,2,2,2,2,3,2,2,2,5,2,3,3,2,4,2,2,2,
%T A355034 2,2,2,3,2,2,2,3,2,3,4,2,2,2,2,3,2,3,3,2,2,3,4,2,6,2,2,3,18,2,2,2,2,2,
%U A355034 2,3,2,2,2,3,2,3,6,2,2,2,2,3,2,3,4,2,2
%N A355034 a(n) is the least base b >= 2 where the sum of digits of n is a prime number.
%C A355034 The sequence is well defined:
%C A355034 - a(2) = 3,
%C A355034 - for n >= 3, the expansion of n in base n-1 is "11", with sum of digits 2.
%H A355034 Rémy Sigrist, <a href="/A355034/b355034.txt">Table of n, a(n) for n = 2..10000</a>
%F A355034 a(n) = 2 iff n belongs to A052294.
%F A355034 a(n) <= n-1 for any n >= 3.
%e A355034 For n = 16:
%e A355034 - we have the following expansions and sum of digits:
%e A355034      b  16_b     Sum of digits in base b
%e A355034      -  -------  -----------------------
%e A355034      2  "10000"                        1
%e A355034      3    "121"                        4
%e A355034      4    "100"                        1
%e A355034      5     "31"                        4
%e A355034      6     "24"                        6
%e A355034      7     "22"                        4
%e A355034      8     "20"                        2
%e A355034 - so a(16) = 8.
%o A355034 (PARI) a(n) = for (b=2, oo, if (isprime(sumdigits(n,b)), return (b)))
%o A355034 (Python)
%o A355034 from sympy import isprime
%o A355034 from sympy.ntheory.digits import digits
%o A355034 def a(n):
%o A355034     b = 2
%o A355034     while not isprime(sum(digits(n, b)[1:])): b += 1
%o A355034     return b
%o A355034 print([a(n) for n in range(2, 89)]) # _Michael S. Branicky_, Jun 16 2022
%Y A355034 Cf. A052294, A216789, A355035 (corresponding prime numbers).
%K A355034 nonn,base
%O A355034 2,1
%A A355034 _Rémy Sigrist_, Jun 16 2022