Goldbach`s Conjecture
Goldbach's conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states:
Every even integer, greater than 2, can be expressed as the sum of two primes [1].
Now your task is to check whether this conjecture holds for integers up to 107.
InputInput starts with an integer T (≤ 300), denoting the number of test cases.
Each case starts with a line containing an integer n (4 ≤ n ≤ 107, n is even).
OutputFor each case, print the case number and the number of way

Goldbach's Conjecture 是数论中一个未解决的问题,本题要求验证对于不超过10^7的偶数,是否都能表示为两个素数之和。题目给出输入包含测试用例数量和偶数n,需要输出符合条件的素数对的数量。解决方案是使用素数筛选法,预先存储一定范围内的素数,然后计算符合a+b=n且a<=b的素数对数量。
最低0.47元/天 解锁文章
1414

被折叠的 条评论
为什么被折叠?



