Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A278959 Length of the string that is generated by the concatenation of all the prime numbers < n (where n >= 0). 1
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, 14, 16, 16, 18, 18, 18, 18, 18, 18, 20, 20, 20, 20, 22, 22, 24, 24, 24, 24, 26, 26, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 30 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,5
COMMENTS
In the following Python program, the algorithm based on the sieve of Eratosthenes is used to generate the primes.
LINKS
EXAMPLE
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.
MATHEMATICA
Join[{0}, Accumulate[Table[If[PrimeQ[n], IntegerLength[n], 0], {n, 0, 60}]]] (* Harvey P. Dale, Mar 04 2023 *)
PROG
(Python)
def p(n):
if n<=2:
return 0
s=1
l = [True] * n
for i in range(3, int(n**0.5)+1, 2):
if l[i]:
l[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1)
for i in range(3, n, 2):
if l[i]:
s+=len(str(i))
return s
for i in range(0, 100001):
print str(i)+" "+str(p(i))
CROSSREFS
Sequence in context: A234309 A306921 A048686 * A090501 A361385 A126848
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Dec 02 2016
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 18 17:05 EDT 2024. Contains 375269 sequences. (Running on oeis4.)