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.
%I A014840 #24 Nov 08 2024 03:00:45 %S A014840 2,2,7,2,15,10,15,8,34,12,45,22,31,32,73,28,90,40,57,50,135,46,118,74, %T A014840 117,70,198,58,222,120,139,122,192,92,296,152,216,136,372,112,408,202, %U A014840 235,208,497,176,442,224,338,260,607,202,454,276,416,330,755,194,776 %N A014840 Sum of all the digits of n in every base prime to n from 2 to n-1. %H A014840 Robert Israel, <a href="/A014840/b014840.txt">Table of n, a(n) for n = 3..10000</a> %p A014840 f:= proc(n) local b; %p A014840 add(convert(convert(n,base,b),`+`), b = select(t -> igcd(t,n)=1, [$2..n-1])) %p A014840 end proc: %p A014840 map(f, [$3..100]); # _Robert Israel_, Nov 08 2024 %t A014840 Table[Sum[If[CoprimeQ[i, n], Mod[Total[IntegerDigits[n, i]], n], 0], {i, 2, n-1}], {n, 3, 61}] (* _Stefano Spezia_, Sep 06 2022 *) %o A014840 (PARI) a(n) = {s = 0; for (i=2, n-1, if (gcd(i, n) == 1, d = digits(n, i); s += sum(j=1, #d, d[j]););); s;} \\ _Michel Marcus_, May 30 2014 %o A014840 (Python) %o A014840 from math import gcd %o A014840 from sympy.ntheory import digits %o A014840 def a(n): return sum(sum(digits(n, b)[1:]) for b in range(2, n) if gcd(b, n) == 1) %o A014840 print([a(n) for n in range(3, 62)]) # _Michael S. Branicky_, Sep 06 2022 %Y A014840 Cf. A014836, A014837, A014838, A014839, A014841, A014842, A014843. %K A014840 nonn,base,look %O A014840 3,1 %A A014840 _Olivier Gérard_