A355017 a(n) is the number of bases in 2..n in which the sum of the digits of n is prime.
0, 1, 1, 3, 4, 4, 3, 5, 6, 7, 7, 8, 7, 8, 5, 11, 9, 10, 8, 13, 8, 12, 9, 13, 11, 12, 10, 15, 11, 16, 10, 17, 10, 20, 12, 20, 14, 18, 13, 21, 13, 22, 13, 20, 14, 25, 14, 22, 18, 22, 15, 26, 12, 29, 17, 25, 15, 27, 15, 30, 19, 26, 14, 32, 17, 33, 19, 27, 19, 31, 18, 34, 19, 29, 19, 37, 16, 33, 21, 30, 24, 39, 20, 38
Offset: 2
Examples
For n=7, express 7 in all bases from 2 to 7, then add the numbers, counting those which are prime: base 2: 1 1 1 --> 1+1+1=3 prime base 3: 2 1 --> 2+1=3 prime base 4: 1 3 --> 1+3=4 nonprime base 5: 1 2 --> 1+2=3 prime base 6: 1 1 --> 1+1=2 prime base 7: 1 --> 1=1 nonprime The sum of the digits of the base-b expansion of 7 in 4 different bases b (2, 3, 5, and 6) from base 2 to 7 is prime, so a(7)=4.
Links
- Samuel Harkness, Table of n, a(n) for n = 2..10000
- Samuel Harkness, Colored Scatterplot of the first 50000 terms, with n as multiples of 2 or 3
- Samuel Harkness, Colored Scatterplot of the first 50000 terms, with the lowest factor of n among 5, 7, 11, or 13
- Rémy Sigrist, Scatterplot of (n, b) such that the sum of digits of n in base b is prime (with n = 1..1000, b = 2..n).
- Rémy Sigrist, Colored scatterplot of the first 50000 terms (where the color is function of gcd(n, 2*3*5)).
Programs
-
Mathematica
a[n_] := Count[Range[2, n], ?(PrimeQ[Plus @@ IntegerDigits[n, #]] &)]; Array[a, 84, 2] (* _Amiram Eldar, Jun 17 2022 *)
-
PARI
a(n) = sum(b=2, n, isprime(sumdigits(n, b))); \\ Michel Marcus, Jun 16 2022
-
Python
from sympy.ntheory import isprime, digits def A355017(n): return sum(1 for b in range(2,n) if isprime(sum(digits(n,b)[1:]))) # Chai Wah Wu, Jun 17 2022
Comments