POJ2262问题描述


Goldbach‘s Conjecture

Description

In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:

Every even number greater than 4 can be 
written as the sum of two odd prime numbers.

For example:

8 = 3 + 5. Both 3 and 5 are odd prime numbers. 
20 = 3 + 17 = 7 + 13. 
42 = 5 + 37 = 11 + 31 = 13 + 29 = 19 + 23.

Today it is still unproven whether the conjecture is right. (Oh wait, I have the proof of course, but it is too long to write it on the margin of this page.) 
Anyway, your task is now to verify Goldbach‘s conjecture for all even numbers less than a million.

Input

The input will contain one or more test cases. 
Each test case consists of one even integer n with 6 <= n < 1000000. 
Input will be terminated by a value of 0 for n.

Output

For each test case, print one line of the form n = a + b, where a and b are odd primes. Numbers and operators should be separated by exactly one blank like in the sample output below. If there is more than one pair of odd primes adding up to n, choose the pair where the difference b - a is maximized. If there is no such pair, print a line saying "Goldbach‘s conjecture is wrong."

Sample Input

8
20
42
0

Sample Output

8 = 3 + 5
20 = 3 + 17
42 = 5 + 37
时间: 2024-08-05 17:38:07

POJ2262问题描述的相关文章

查询字段描述sql-postgresql

查询字段描述sql SELECT 'comment on column ' || n.nspname ||'.'|| c.relname || '.' || a.attname ||' is '''|| col_description(a.attrelid,a.attnum) ||''';' FROM pg_class as c join pg_attribute as a on a.attrelid = c.oid join pg_namespace n on c.relnamespace=n

数据结构与算法C++描述学习笔记1、辗转相除——欧几里得算法

前面学了一个星期的C++,以前阅读C++代码有些困难,现在好一些了.做了一些NOI的题目,这也是一个长期的目标中的一环.做到动态规划的相关题目时发现很多问题思考不通透,所以开始系统学习.学习的第一本是<数据结构与算法C++描述>第三版,边学边做一些笔记.所以这些笔记中的代码有很多将会非常简单,甚至可能只有一个记录或者结论. 辗转相除法用来求两个整数的最大公约数,即能同时整除两个数的最大整数.程序如下: int gdc(int m,int n){ int rem; while(n!=0){ //

进程描述符

进程描述 广义上讲,所有进程信息被放在一个叫做进程控制块的数据结构中,可以理解为进程属性的集合. 进程控制块 每个进程在内核中都有一个进程控制块(PCB)来维护进程相关的信息,Linux内核的进程控制块是task_struct结构体. task_struct结构体 task_struct是Linux内核下的一种数据结构,它会被装载到RAM里并且包含着进程的信息,每个进程把它的信息放在task_struct结构体里task_struct包含了这些内容: 标示符:描述本进程的唯一标示符 状态:任务状

获取枚举类型Description特性的描述信息

C#中可以对枚举类型用Description特性描述. 如果需要对Description信息获取,那么可以定义一个扩展方法来实现.代码如下: public static class EnumExtensions { public static string GetDescription(this object value) { if (value==null) return string.Empty; Type type = value.GetType(); var fieldInfo = ty

设计模式-单例模式(Go语言描述)

这篇博客我们继续来看设计模式,今天带来的是一个最简单而且最常用的模式-单例模式.那什么是单例模式呢?相信大家最它最熟悉不过了,那我们就来快速的了解一下它的定义. 保证一个类仅有一个实例,并提供一个访问它的全局访问点. 这个解释足够简单.说白了就是假如我们希望我们在我们的系统中该类仅仅存在1个或0个该类的实例.虽然单例模式很简单,但是熟悉java的同学可能了解,单例模式有很多写法,懒汉式.饿汉式.双重锁... 这么多形式,难道有什么目的?确实,不过他们的目的很明确,就是保证在一种特殊情况下的单例-

OpenCV4Android 提取特征点描述符(Feature Descriptor)

OpenCV4Android 提取特征点描述符(Feature Descriptor) 在得到keypoints之后(参考前面),通过使用相应的FeatureDescriptor就可计算得到关键点处的描述子. Native Code: JNIEXPORT void JNICALL Java_com_example_test_NativeUtil_computeDescripors( JNIEnv *env, jclass thiz, jlong mGrayAddr, jlong mRgbaAdd

USB 描述符

标准的USB设备有5种USB描述符:设备描述符,配置描述符,字符串描述符,接口描述符,端点描述符. 1 // Standard Device Descriptor 2 typedef struct 3 { 4 u8 bLength; 5 u8 bDescriptorType; 6 u16 bcdUSB; 7 u8 bDeviceClass; 8 u8 bDeviceSubClass; 9 u8 bDeviceProtocol; 10 u8 bMaxPacketSize0; 11 u16 idVe

文件描述符与文件指针等文件操作的几个问题

1.二者对比: 文件描述符就是open文件时产生的一个整数,直到一个索引作用,它用于UNIX系统中,用于标识文件.它是系统调用产生的. 文件指针是指向一个FILE的结构体,这个结构体里有一个元素就是文件描述符.它用于ANSI C标准的IO库调用中,用于标识文件.fopen是依赖于open的: 既然FILE中包含文件描述符元素,可以用fopen()直接获取指针fp,然后使用fp获得fp中所包含文件描述符fd的信息. 文件描述符应该是唯一的,但文件指针(值)却不是唯一的,但指向的对象却应该是唯一的.

UNIX环境编程学习笔记(4)——文件I/O之dup复制文件描述符

lienhua342014-08-23 UNIX 提供了两个函数 dup 和 dup2 用于复制一个现存的文件描述符. #include <unistd.h> int dup(int filedes); int dup2(int filedes, int filedes2); 返回值:若成功则返回新的文件描述符,如出错则返回-1. 由 dup 函数返回的文件描述符一定是当前可用文件描述符中的最小描述符.用 dup2 函数则可以通过参数 filedes2 指定目标文件描述符.如果filedes2