
prime number finder.
well the other day i noticed that the diferance between 2 perfect squares is a prime number, so i made a program that does the math for you.
Code:
#include<iostream>
using namespace std;
int counter = 1;
int main()
{
int num1;
do
{
cout << "enter a number: ";
cin >> num1;
int num2 = num1 + 1;
int square1 = num1 * num1;
int square2 = num2 * num2;
int prime = square2  square1;
cout << "your prime number is: " << prime << endl;
}
while (counter = 1);
cin.get();
return 0;
}
yeah i couldnt get a "yes/no would you like to do it again" thing to work, so i just made it loop like that.
also, dont try to enter a letter, it spazzes out. :confused:

5^2 = 25
4^2 = 16
25  16 = 9, which is not a prime.
I regret to inform you that your theorem doesn't hold, but I genuinely applaud your interest in number theory. I suggest getting a book on the subject or taking a course in it. It's good stuff.

damnit, i just came to inform you of that, heh. :p
i've been testing it all morning and just decided to work with the small numbers, damn small numbers make me feal stupid :( lol:D
i tested up to getting the answer 65. here are my results. number i put in)number i got(numbers its devisible by
4)9(3
7)15(3,5
10)21(7
12)25(5
17)35(5,7
22)45(5,915,3
24)49(7
27)55(5,11
32)65(5,13
it seems that its almost true, except for being devisible by the prime numbers themselves, and  in the of 22, a number previouly gotten.
i still have work. thanks for wasting your time to read that ;)