Project Euler #134: Prime pair connection

  • + 1 comment

    I still got TLE :,v

    • + 1 comment

      me too , i have find some "tutorials" in web;s author: Kristan but only earn 50 d , when n>100000000 , i use miller rebin but it still over time .

      • + 0 comments

        When testing for many primes in bulk, Miller Rabin is actually quite slow. A Sieve of Eratosthenes may be faster.

        But before changing your code, find out which part is slow: the prime testing, or finding the S values.