%I #23 Mar 01 2023 14:55:26
%S 1,3,3,6,6,10,11,11,10,15,16,22,21,21,23,30,32,40,42,42,39,48,52,53,
%T 49,52,53,63,66,77,83,82,76,77,82,94,87,85,90,103,107,121,123,129,120,
%U 135,144,147,153,150,151,167,176,178,185,181,168,185,194,212,199
%N a(n) is the sum of all digits of n in every prime base 2 <= p <= n.
%H Amiram Eldar, <a href="/A343481/b343481.txt">Table of n, a(n) for n = 2..10001</a>
%H Robin Fissum, <a href="https://hdl.handle.net/11250/2980249">Digit sums and the number of prime factors of the factorial n!=1.2...n</a>, Bachelor's project in BMAT, Norwegian University of Science and Technology, 2020; <a href="https://www.researchgate.net/publication/352837134_Digit_sums_and_the_number_of_prime_factors_of_the_factorial_n12n">ResearchGate link</a>.
%F a(n) ~ (1-Pi^2/12)*n^2/log(n) + c*n^2/log(n)^2 + o(n^2/log(n)^2), where c = 1 - Pi^2/24 + zeta'(2)/2 = 1 - A222171 - (1/2)*A073002 = 0.1199923561... (Fissum, 2020).
%e 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.
%t 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]
%o (PARI) a(n) = sum(b=2, n, if (isprime(b), sumdigits(n, b))); \\ _Michel Marcus_, Apr 17 2021
%Y Cf. A014837, A043306, A072691, A073002, A222171.
%K nonn,base
%O 2,2
%A _Amiram Eldar_, Apr 16 2021