A343481 a(n) is the sum of all digits of n in every prime base 2 <= p <= n.
1, 3, 3, 6, 6, 10, 11, 11, 10, 15, 16, 22, 21, 21, 23, 30, 32, 40, 42, 42, 39, 48, 52, 53, 49, 52, 53, 63, 66, 77, 83, 82, 76, 77, 82, 94, 87, 85, 90, 103, 107, 121, 123, 129, 120, 135, 144, 147, 153, 150, 151, 167, 176, 178, 185, 181, 168, 185, 194, 212, 199
Offset: 2
Examples
a(5) = 6 since in the prime bases 2, 3 and 5 the representations of 5 are 101_2, 12_3 and 10_5, respectively, and (1 + 0 + 1) + (1 + 2) + (1 + 0) = 6.
Links
- Amiram Eldar, Table of n, a(n) for n = 2..10001
- Robin Fissum, Digit sums and the number of prime factors of the factorial n!=1.2...n, Bachelor's project in BMAT, Norwegian University of Science and Technology, 2020; ResearchGate link.
Programs
-
Mathematica
s[n_, b_] := Plus @@ IntegerDigits[n, b]; ps[n_] := Select[Range[n], PrimeQ]; a[n_] := Sum[s[n, b], {b, ps[n]}]; Array[a, 100, 2]
-
PARI
a(n) = sum(b=2, n, if (isprime(b), sumdigits(n, b))); \\ Michel Marcus, Apr 17 2021