using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GoetheOfArithmetic
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一个大于6的偶数:");
            int intNum = Convert.ToInt32(Console.ReadLine());
            bool blFlag = ISGDBHArith(intNum);
            if (blFlag)
            {
                Console.WriteLine("{0}能写成两个素数的和,所以其符合哥德巴赫猜想。", intNum);
            }
            else
            {
                Console.WriteLine("猜想错误");
            }
            Console.ReadLine();
        }

        static bool ISGDBHArith(int intNum)
        {
            bool blFlag = false;
             ==  && intNum > )
            {
                ; i < intNum / ; i++)
                {
                    bool bl1 = IsPrimeNumber(i);
                    bool bl2 = IsPrimeNumber(intNum - i);

                    if (bl1 & bl2)
                    {
                        Console.WriteLine("{0}={1}+{2}", intNum, i, intNum - i);
                        blFlag = true;
                    }
                }
            }

            return blFlag;
        }

        static bool IsPrimeNumber(int intNum)
        {
            bool blFlag = true;
             || intNum == )
            {
                blFlag = true;
            }
            else
            {
                int sqr = Convert.ToInt32(Math.Sqrt(intNum));
                ; i--)
                {
                    )
                    {
                        blFlag = false;
                    }
                }
            }
            return blFlag;
        }
    }
}

C#实现哥德巴赫猜想的更多相关文章

  1. *CF2.D(哥德巴赫猜想)

    D. Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...

  2. code forces 382 D Taxes(数论--哥德巴赫猜想)

    Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output ...

  3. CF735D Taxes 哥德巴赫猜想\判定素数 \进一步猜想

    http://codeforces.com/problemset/problem/735/D 题意是..一个数n的贡献是它的最大的因子,这个因子不能等于它本身 然后呢..现在我们可以将n拆成任意个数的 ...

  4. Codeforces Round #382 (Div. 2) D. Taxes 哥德巴赫猜想

    D. Taxes 题目链接 http://codeforces.com/contest/735/problem/D 题面 Mr. Funt now lives in a country with a ...

  5. Codeforces 735D:Taxes(哥德巴赫猜想)

    http://codeforces.com/problemset/problem/735/D 题意:给出一个n,这个n可以分解成 n = n1 + n2 + -- + nk,其中k可以取任意数.要使得 ...

  6. LightOJ 1259 Goldbach`s Conjecture (哥德巴赫猜想 + 素数筛选法)

    http://lightoj.com/volume_showproblem.php?problem=1259 题目大意:给你一个数n,这个数能分成两个素数a.b,n = a + b且a<=b,问 ...

  7. Codeforces Round #324 (Div. 2) D. Dima and Lisa 哥德巴赫猜想

    D. Dima and Lisa Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/584/probl ...

  8. 哥德巴赫猜想证明(C语言实现50以内的正偶数证明)

    <一>哥德巴赫猜想内容: 一个充分大的偶数(大于或等于6)可以分解为两个素数之和. <二>实现要点: 要点: 判断素数(质数):除了1和本身没有其他约数. 最小的质数:2 判断 ...

  9. c语言验证哥德巴赫猜想(从4开始 一个偶数由两个质数之和)

    #include <stdio.h> #include <stdlib.h> #include <math.h> int isit(int num) { int i ...

随机推荐

  1. Logback配置连接

    logback 简介 logback 常用配置详解(一)<configuration> and <logger> logback 常用配置详解(二)<appender&g ...

  2. web 前端- 表格字段(文件大小)单位格式化算法

                     if (value === 0) return '0 B';   var k = 1024, // or 1000   sizes = ['B', 'KB', 'MB ...

  3. Python for Infomatics 第13章 网页服务四(译)

    这几天因为其他事务,打断了自己的学习计划,今天继续我的翻译,避免又中途而废. 注:文章原文为Dr. Charles Severance 的 <Python for Informatics> ...

  4. 伪类before和after

     以你添加的元素为基础!在他的里面!也就是他的内容的前面或者后面添加东西!  如果原来的元素没有内容会出现什么情况?(伪类的宽和高和元素的相等)

  5. tessnet2.Tesseract Init程序退出问题解决

    1.检查语言包与引用库版本是否一致.2.0需要使用2.0的语言包.(http://www.pixel-technology.com/freeware/tessnet2/) 2.是否安装过3.0,安装中 ...

  6. C#输出文字对齐,空格位数对齐

    Align String with Space This example shows how to align strings with spaces. The example formats tex ...

  7. 最常见的 20 个 jQuery 面试问题及答案

    jQuery 面试问题和答案 JavaScript 是客户端脚本的标准语言,而 jQuery 使得编写 JavaScript 更加简单.你可以只用写几行的jQuery 代码就能实现更多的东西. 它是最 ...

  8. 关于ARC下需要dealloc的相关内容

    今天在项目中使用KVO添加观察者模式的时候,在返回上一级的时候竟然崩了.可是,看了很久,代码没有问题.最后,终于知道了需要添加dealloc 防止以后再出错,所以,便纪录下来.关于ARC下需要手动释放 ...

  9. 新版startssl 免费SSL证书申请 (实测 笔记 https http2 必要条件)

    简单说明: 目前多个大型网站都实现全站HTTPS,而SSL证书是实现HTTPS的必要条件之一. StartSSL是StartCom公司旗下的.提供免费SSL证书服务并且被主流浏览器支持的免费SSL.包 ...

  10. Smart3D系列教程3之 《论照片三维重建中Smart3D几个工作模块的功能意义》

    [摘要] 近年来,倾斜摄影测量技术是国际测绘遥感领域近年发展起来的一项高新技术,利用照片进行三维重建成为一项关键性的技术.Smart3D软件,是照片三维重建主流软件之一,本文将就Smart3D建模软件 ...