The procedure is as follows:
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?
A: The program is looking for a number from 2 to 31, not divisible by two consecutive numbers, but can be divisible by the remaining 28 numbers;
Question 2: Does such a number exist? What is the minimum number that meets this condition?
Answer: This number exists, it is 2123581660200 (except 16, 17 least common multiple);
Question 3: How long do you expect to be able to output the first result when running this program on a computer? Time accurate to minutes (PC: Single core CPU 4.0G Hz, memory and hard disk, etc. sufficient resources)
Answer: This time I really do not calculate, ask the great God to explain;
Question 4: How can I improve the efficiency of this program on multi-core computers?
A: For example: A program can be composed of three functions, the first is a multiplied by B, the second is C+d, the third is the square of E, the three is not directly related to the "task" is can be split into three things, respectively, to three cores simultaneously executed, but how to achieve, it will be combined with the compiler and processor to achieve.
Third week assignment: Read the program