Monday, January 03, 2005
find that prime
ok. People concluded that there are infinitely but countably many primes.
Proof: you first construct a finite set which has 'all' primes in the world.
Then you multiply each prime and add 1 to it.
CODE:
And just for fun, I wrote isPriime(int) function:
The function is not tested...maybe it doesn't work...lol; //i'm lame
The thing is, I thought I could generate primes using the proof of infinity of # of primes.
Like: base case is "2 is prime". 2 belongs to the set of primes.
Induction: assume product of the elements in the set of primes + 1 results another prime for |set of primes| <= 1. (or >=1 i don't know...)
Current |set of primes| = 1 and 2+1 = 3 is a prime.
|set of primes| = 2 now. Let's say Set of Primes = P = { 2, 3 }
2*3+1 = 7 is a prime. P = { 2,3,7 }
2*3*7+1 = 43 is a prime!!! I thought I found something at this point...
P is now = { 2,3,7,43 }
2*3*7*43+1 = (43-1)*43+1 = 1807 is NOT a prime.
It took about 3 minuites to get 1807 on the paper ( bad arithmetician).
I thoght 1807 was a prime because it looks like it. But when I checked the web, 1807 wasn't listed as prime....
Ahhhhhh I really thought I figured something out...lol..I'm still lame.
Proof: you first construct a finite set which has 'all' primes in the world.
Then you multiply each prime and add 1 to it.
CODE:
int len = fetch primetable.txt from ftp://International Prime Institution.net and calculate # of primes in the table;
unsigned int[] prime_set = new int[len];//let's say that len is 34253252365323
int product = 1;
for( int i=0; iproduct *= prime_set[i];
}//for
product++;
if( isPrime(product) ) {
System.out.println("IPI owned. I found new prime that doesn't belong to the primetable.txt which they say includes all primes. lol");
}//if
else {
System.out.println("the function isPrime(int) is not working properly. lol");
}//else
And just for fun, I wrote isPriime(int) function:
public static boolean isPrime( int p ) {
int count = 0;
for( int i=1; i<=Math.sqrt(p); i++ ) {
if( p%i == 0 ) {
count++;
}//if
if( count == 3 ) {//p is not prime
return false;
}//if
}//for
return true;
}//isPrime
The function is not tested...maybe it doesn't work...lol; //i'm lame
The thing is, I thought I could generate primes using the proof of infinity of # of primes.
Like: base case is "2 is prime". 2 belongs to the set of primes.
Induction: assume product of the elements in the set of primes + 1 results another prime for |set of primes| <= 1. (or >=1 i don't know...)
Current |set of primes| = 1 and 2+1 = 3 is a prime.
|set of primes| = 2 now. Let's say Set of Primes = P = { 2, 3 }
2*3+1 = 7 is a prime. P = { 2,3,7 }
2*3*7+1 = 43 is a prime!!! I thought I found something at this point...
P is now = { 2,3,7,43 }
2*3*7*43+1 = (43-1)*43+1 = 1807 is NOT a prime.
It took about 3 minuites to get 1807 on the paper ( bad arithmetician).
I thoght 1807 was a prime because it looks like it. But when I checked the web, 1807 wasn't listed as prime....
Ahhhhhh I really thought I figured something out...lol..I'm still lame.
0 Comments:
Post a Comment
<< Home