求一个素数是第几个素数,用c#编写

[复制链接]
查看11 | 回复2 | 2013-9-6 08:05:47 | 显示全部楼层 |阅读模式
// 求质数序号,2为第一个。很快,感觉不要时间。using System;class A{static void Main(){
//
int n = 88001;
bool[] zss = new bool[n+1];
int sqrtn = (int)Math.Sqrt(n);
int count = 1; for(int i = 3; i <= sqrtn; i += 2) // 只检查奇数 {
if (!zss)
{
for(int j = i+i; j <= n; j += i) zss[j] = true;/...
回复

使用道具 举报

千问 | 2013-9-6 08:05:47 | 显示全部楼层
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics;namespace ConsoleApplication2{
class Program
{
static bool I...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行