It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.

9 = 7 + 212
15 = 7 + 222
21 = 3 + 232
25 = 7 + 232
27 = 19 + 222
33 = 31 + 212

It turns out that the conjecture was false.

What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?

题目大意:

Christian Goldbach 提出每个奇合数都可以写作一个质数与一个平方数的二倍之和:

9 = 7 + 212
15 = 7 + 222
21 = 3 + 232
25 = 7 + 232
27 = 19 + 222
33 = 31 + 212

但是这个推测是错误的。

最小的不能写作一个质数与一个平方数的二倍之和的奇合数是多少?

//(Problem 46)Goldbach's other conjecture
// Completed on Fri, 26 Jul 2013, 16:58
// Language: C11
//
// 版权所有(C)acutus (mail: acutus@126.com)
// 博客地址:http://www.cnblogs.com/acutus/
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<stdbool.h> bool issquare(int n) //判断一个自然数是否为一个平方数
{
if(ceil(sqrt(n))*ceil(sqrt(n))==n) return true;
else return false;
} bool isprim(int n) //素数判断
{
for(int i=; i*i<=n; i++)
{
if(n%i==) return false;
}
return true;
} bool judge(long long n)
{
int i=;
long long t;
while((t=(n-*(i*i)))>)
{
if(isprim(t)) return true;
i++;
}
return false;
} int main()
{
for(long long i=; i<; i=i+)
{
if(!isprim(i) && !judge(i))
{
printf("%lld\n",i);
break;
}
}
return ;
}
Answer:
5777

(Problem 46)Goldbach's other conjecture的更多相关文章

  1. (Problem 73)Counting fractions in a range

    Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called ...

  2. (Problem 42)Coded triangle numbers

    The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangl ...

  3. (Problem 41)Pandigital prime

    We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly o ...

  4. (Problem 70)Totient permutation

    Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number ...

  5. (Problem 74)Digit factorial chains

    The number 145 is well known for the property that the sum of the factorial of its digits is equal t ...

  6. (Problem 72)Counting fractions

    Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called ...

  7. (Problem 53)Combinatoric selections

    There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 2 ...

  8. (Problem 49)Prime permutations

    The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...

  9. (Problem 47)Distinct primes factors

    The first two consecutive numbers to have two distinct prime factors are: 14 = 2  7 15 = 3  5 The fi ...

随机推荐

  1. ArcMap制图_显示指定区域地图内容

    摘要:有一张完整的中国地图,有时仅要求针对某一特定区域制图,那么如何在不进行裁剪的情况下仅显示该区域范围的要素内容? 步骤: 1.打开ArcMap,加载完整的中国地图: 2.将要显示的区域范围制作成一 ...

  2. JavaScript引用类型之Array类型一

    一.简介 除了Object之外,Array类型恐怕是ECMAScript中最常用的类型了.下面就来分析ECMAScript中的数组与其他语言中的数组的异同性: 1.相同点: (1)他们都是数据的有序列 ...

  3. iOS 模态视图转场的动画效果

    ModalViewController * modalView = [[ModalViewController alloc]init]; modalView.modalTransitionStyle ...

  4. ubuntu 下安装sublime

    终于还是要面临找工作了,太多需要linux下的操作经验和技巧的,被迫换了电脑的操作系统哦概念,一切环境都要重新配置,Window下的软件直接个软件包就可以搞定,ubuntu下一般的也都可以通过apt- ...

  5. (总结)Nginx/LVS/HAProxy负载均衡软件的优缺点详解

    PS:Nginx/LVS/HAProxy是目前使用最广泛的三种负载均衡软件,本人都在多个项目中实施过,参考了一些资料,结合自己的一些使用经验,总结一下. 一般对负载均衡的使用是随着网站规模的提升根据不 ...

  6. 一次http完整的请求tcp报文分析

    一次http请求的报文分析 数据包如下: 第一个包113.31的主机(下边称之为客户端)给114.80的主机(下边称之为服务器)发送一个syn包请求建立连接 第二个包服务器回复客户端syn+ack表示 ...

  7. jar文件につぃて

    打包jar文件和设置class路径: 查看jar文件内容:

  8. PCB成型製程介紹

    PCB成型製程在電子構裝中所扮演的角色 下圖是電腦主機的內部組成 我們將以插在主機板上的一片 USB擴充卡來說明PCB成型製 程在電子構裝中所扮演的角色 PCB成型製程的子製程 USB擴充卡要插入主機 ...

  9. Mysql 忘密码 + Phpadmin 修改密码无法登陆

    mysql有时候忘记密码了怎么办?我给出案例和说明!一下就解决了! Windows下的实际操作如下 1.关闭正在运行的MySQL. 2.打开DOS窗口,转到mysql\bin目录. 3.输入mysql ...

  10. HDU 5726 GCD(DP)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5726 [题目大意] 给出数列An,对于询问的区间[L,R],求出区间内数的GCD值,并且求出GCD ...