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.

A283556 Digital root of the sum of the first n primes.

This page as a plain text file.
%I A283556 #41 May 10 2021 04:58:03
%S A283556 0,2,5,1,8,1,5,4,5,1,3,7,8,4,2,4,3,8,6,1,9,1,8,1,9,7,9,4,3,4,9,1,6,8,
%T A283556 3,8,6,1,2,7,9,8,9,2,6,5,6,1,8,1,5,4,9,7,6,2,4,3,4,2,4,8,4,5,1,8,1,8,
%U A283556 3,8,6,8,7,5,9,1,6,8,9,5,9,5,3,2,3,1,3,2,9,2,6,5,7,8,4,8,7,3,2,3
%N A283556 Digital root of the sum of the first n primes.
%H A283556 Robert Israel, <a href="/A283556/b283556.txt">Table of n, a(n) for n = 0..10000</a>
%F A283556 a(n) = ((A007504(n) - 1) mod 9) + 1.
%F A283556 a(n) = ((A051351(n) - 1) mod 9) + 1.
%F A283556 a(n) = A010888(A007504(n)). - _Michel Marcus_, Mar 26 2017
%e A283556 For n=3, a(3)=1 because the sum of the first 3 primes is 10 and the sum of digits of 10 is 1.
%p A283556 0, op(subs(0=9, ListTools:-PartialSums(select(isprime, [2,seq(i,i=3..1000,2)])) mod 9)); # _Robert Israel_, Mar 30 2017
%t A283556 With[{nn = 78}, {0}~Join~Table[NestWhile[Total@ IntegerDigits@ # &, #, # >= 10 &] &@ Total@ Take[#, n], {n, nn}] &@ Array[Prime, nn]] (* _Michael De Vlieger_, Mar 15 2017 *)
%o A283556 (PARI) {
%o A283556 p=0;print1(p", ");
%o A283556 forprime(n=2,1000,
%o A283556          p+=n;
%o A283556          while(p>9,p=sumdigits(p))
%o A283556          ;print1(p", ")
%o A283556         )
%o A283556 }
%o A283556 (Python)
%o A283556 from sympy import primerange
%o A283556 from itertools import accumulate
%o A283556 prime_sum = [0] + list(accumulate(primerange(2, 1000)))
%o A283556 def dig_root(n): return 1+(n-1)%9
%o A283556 def a(n):
%o A283556     return 0 if n<1 else dig_root(prime_sum[n])
%o A283556 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Mar 30 2017
%Y A283556 Cf. A007504, A010888, A051351.
%K A283556 nonn,base
%O A283556 0,2
%A A283556 _Dimitris Valianatos_, Mar 10 2017
%E A283556 Corrected by _Robert Israel_, Mar 30 2017