Using System;
Using System.Collections.Generic;
Using System.Text;
Namespace Findthenumber
{
Class Program
{
static void Main (string[] args)
{
int [] RG =
{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
20,21,22,23,24,25,26,27,28,29,30,31};
for (Int64 i = 1; i < int64.maxvalue; i++)
{
int hit = 0;
int hit1 =-1;
int hit2 =-1;
for (int j = 0; (J < RG. Length) && (hit <=2); J + +)
{
if ((i% rg[j])! = 0)
{
hit++;
if (hit = = 1)
{
Hit1 = j;
}
else if (hit = = 2)
{
Hit2 = j;
}
Else
Break
}
}
if (hit = = 2) && (HIT1+1==HIT2))
{
Console.WriteLine ("Found {0}", i);
}
}
}
}
}
Question 1: What are the criteria for this program?
Question 2: Does such a number exist? What is the minimum number that meets this condition?
Question 3: How long do you expect to be able to output the first result when running this program on a computer? The time is accurate to minutes (computer: Single core CPU 4.0G Hz, memory and hard disk resources are sufficient).
Question 4: How can I improve the efficiency of this program on multi-core computers?
For:
1. Read the morning did not read, afternoon enlightened. This program is to find a number, this number can not be divisible into 2-32 of any two "adjacent" number, but can be divisible by any number of other.
2.
31=31 30=2*3*5 29=29 28=2*2*7 27=3*3*3 26=2*13 25=5*5 24=2*2*2*6 23=23
22=2*11 21=3*7 20=2*2*5 & nbsp 19=19 18=2*3*3 &NBSP;17=17 16=2*2*2*2 15=3*5 14=2*7 11=11 & nbsp 10=2*5 9=3*3 &NBSP;8=2*2*2 7=7 &NBSP;6=2*3 &N Bsp 5=5 4=2*2 & nbsp 3=3 2=2
First of all, to find the largest number must first find the "adjacent" the two number, it is easy to think of the two numbers in the 16~31 between the two. So it must be 16,17. Because the large number can be divided evenly, the smaller number must be divisible.
In addition to the number of prime numbers, each number can be split into prime multiplied form, so the numbers to be asked must contain {2.3.5.7.11.13.19.23.29.31}
In the re-analysis formula, which contains 2,2*2,2*2*2, it is learned that the formula containing the most items must be chosen. That requires 2*2*2=8,3*3*3=27,5*5=25.
So this "minimum" number is 8*27*25*7*11*13*19*23*29*31=2123581660200.
3.3-4 minutes
4. The integration of two or more complete compute engine (cores) multicore computers in a single processor can perform several operations at the same time, greatly improving execution speed.
Read Program jobs (third week)