PARI/GP practice #3

You could use any interface, but GP is preferable because of its sheer speed.

Find the sum of the 3141592 3141592 th and the 2718281 2718281 th digit from the left of 1000000 ! 1000000!


The answer is 10.

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.

3 solutions

Benjamin Eriksson
Aug 14, 2015

I don't have GP but Mathematica gets the job done.

1
2
 IntegerDigits[ 1000000! ][[3141592]] 
+IntegerDigits[ 1000000! ][[2718281]]

Derek Modzelewski
Jun 16, 2016

How I solved this without a computer:

Prior to any computation, suppose each requested digit has a uniform probability distribution over all digits. Thus, the most probable values for the sum are {8,9,10}, and you have 3 guesses.

*shrug * it worked

Not exactly a fast solution, but worked.

#python

from math import factorial

s = str(factorial(1000000))

print(int(s[3141591])+int(s[2718280]))

PS: Can someone post the GP/PARI equivalent please.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...