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.

A278959 Length of the string that is generated by the concatenation of all the prime numbers < n (where n >= 0).

This page as a plain text file.
%I A278959 #32 Nov 13 2024 16:41:24
%S A278959 0,0,0,1,2,2,3,3,4,4,4,4,6,6,8,8,8,8,10,10,12,12,12,12,14,14,14,14,14,
%T A278959 14,16,16,18,18,18,18,18,18,20,20,20,20,22,22,24,24,24,24,26,26,26,26,
%U A278959 26,26,28,28,28,28,28,28,30
%N A278959 Length of the string that is generated by the concatenation of all the prime numbers < n (where n >= 0).
%C A278959 In the following Python program, the algorithm based on the sieve of Eratosthenes is used to generate the primes.
%H A278959 Indranil Ghosh, <a href="/A278959/b278959.txt">Table of n, a(n) for n = 0..100000</a>
%H A278959 Wikipedia, <a href="https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes">Sieve Of Eratosthenes</a>
%e A278959 For n=15, the primes < n are 2,3,5,7,11,13. So the concatenated string is "23571113", which has length=8. a(n)=8.
%t A278959 Join[{0},Accumulate[Table[If[PrimeQ[n],IntegerLength[n],0],{n,0,60}]]] (* _Harvey P. Dale_, Mar 04 2023 *)
%o A278959 (Python)
%o A278959 def p(n):
%o A278959     if n<=2:
%o A278959         return 0
%o A278959     s=1
%o A278959     l = [True] * n
%o A278959     for i in range(3,int(n**0.5)+1,2):
%o A278959         if l[i]:
%o A278959             l[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
%o A278959     for i in range(3,n,2):
%o A278959             if l[i]:
%o A278959                 s+=len(str(i))
%o A278959     return s
%o A278959 for i in range(0, 100001):
%o A278959     print(f'{i} {p(i)}')
%Y A278959 Cf. A000040, A068670, A097944.
%K A278959 nonn,base
%O A278959 0,5
%A A278959 _Indranil Ghosh_, Dec 02 2016