文章目錄

原题链接http://projecteuler.net/problem=60

Prime pair sets

The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum of these four primes, 792, represents the lowest sum for a set of four primes with this property.

Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime.

素数对集合

素数3,7,109和673非常有特色。取其中任意两个素数,以任意顺序链接起来都是素数。例如,取7和109,7109和1097都是素数。这四个素数的和792,代表着具有这种特征的四素数集中的最小和。

求具有取其中任意两个素数,连接起来都是素数的五素数集的最小和。

解答:

依然是暴力解决。唯一需要注意的是,判断素数的方法必须使用米勒-拉宾素性测试方法,否则速度无法接受。

打赏作者

文章目錄