5, 3, 2, Go!

2017 2003 2001 7 5 3 2 \large { {2017 \, 2003 \, 2001 \ldots 7 \, 5 \, 3 \, 2} }

The above expression shows the concatenation of the prime numbers less than or equal to 2017 written backwards.

Let L L and S S denote the number of digits and the sum of digits, respectively, of this large number. What can you say about the number obtained from the expression given below? 1 10 [ ( S L ) ( m o d 2016 ) ] \dfrac1{10} \left[ (S-L) \pmod{2016} \right]


This problem is a part of set Prime Crimes via Computer Science
It is a perfect cube It is a prime number It is a number less than 100 It is a perfect square

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

David Holcer
Mar 17, 2016
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
def primes(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in xrange(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1)
    return [2] + [i for i in xrange(3,n,2) if sieve[i]]

def digsum(n):
    summ=0
    for i in str(n):
        summ+=int(i)
    return summ

conc=''
for i in primes(2018): conc+=str(i)
l=len(conc)
s=digsum(conc)
print ((s-l)%2016)/10

I used a primes under n generator to find all primes under 2017, added them to an empty string, and found l and s.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...