# Project Euler #123: Prime square remainders

# Project Euler #123: Prime square remainders

+ 1 comment I am getting 10 Sec timeout for test case 3 and even not able to see test case 3 to find out what is wrog. Please let me know the test case.

+ 1 comment Just note that if is even, the remainder is , otherwise, the remainder is .

This is easy to see since

Also remember to look for and small cases.

+ 0 comments Pay attention to

**first exceeds**`B`

.

Build 2 arrays, increasing`r`

and corresponding`n`

.

Here is some strictly increasing remainder values`r`

.

`i`

is the array index.

`n`

is the nth prime.

`pn`

is the prime number at nth.i - n( pn) = r 1 - 2( 3) = 2 2 - 3( 5) = 5 3 - 5( 11) = 110 4 - 7( 17) = 238 5 - 9( 23) = 414 ... 95519 - 191037(2617207) = 999966747318 95520 - 191039(2617243) = 999990970954 95521 - 191041(2617253) = 1000005260746

+ 1 comment can anyone tell me about the test case 2 and test case 3 input i have tried with my custom input it's all working but test 2 and test 3 case were failed,if anyone have a idea about the test case input kindly help me in this

+ 2 comments can anyone tell about test case 2? Any idea about inputs?

Sort 23 Discussions, By:

Please Login in order to post a comment