Project Euler #123: Prime square remainders

  • + 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