题目重现
Give you a prime number
p
, if you could find some natural number (0 is not inclusive)
We call this p a “Special Prime”.
AekdyCoin want you to tell him the number of the “Special Prime” that no larger than
For example:
If L=20
13+7∗12=23
83+19∗82=123
That is to say the prime number 7, 19 are two “Special Primes”.
Input
The input consists of several test cases.
Every case has only one integer indicating
L
.(
Output
For each case, you should output a single line indicate the number of “Special Prime” that no larger than L . If you can’t find such “Special Prime”, just output “No Special Prime!”
Sample Input
7
777
Sample Output
1
10
题解
这是一道数论题。
对于质数
可以导出: n,n+p 一定都是完全立方数。
结论1:
n⊥p
(n, p 互质)
假设
n⊥̸p
,有
n=kp,k∈Z+
原式化为
由引理1得m不是整数,与条件矛盾!假设不成立。
所以 n⊥p 。
因为
gcd(n,n+p)=gcd(p,n)=1
所以
n⊥n+p
所以 n2(n+p)=m3 中 n,n+p 都是完全立方数,并且互质。
设
n=a3,n+p=b3,(b>a)
作差得:
因为 p 是质数,所以 b−a=1 ,可以消去 b 得:
于是:
引理
引理1: k∈Z+,k3+k2 不是完全立方数
假设
k3+k2=a3
显然有
a>k
矛盾!假设不成立,因此对于 k∈Z+,k3+k2 不是完全立方数。