Originally posted by: BamBam215
There has to be a better way than the obvious grunt work.
Originally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
Originally posted by: BamBam215
Originally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
not a programming class 🙂
Originally posted by: Tyler
Originally posted by: BamBam215
Originally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
not a programming class 🙂
So?
Originally posted by: BamBam215
Originally posted by: Tyler
Originally posted by: BamBam215
Originally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
not a programming class 🙂
So?
so even though u've proven you're very l33t in programming, that doesn't help me with the problem.
Originally posted by: Tyler
Originally posted by: BamBam215
Originally posted by: Tyler
Originally posted by: BamBam215
Originally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
not a programming class 🙂
So?
so even though u've proven you're very l33t in programming, that doesn't help me with the problem.
Um, do you know what that does? It takes a list of prime numbers and tells you which ones, when muliplied by 5 and incremented by 1, are perfect squares. That doesn't help with your problem?
Originally posted by: Tyler
Originally posted by: BamBam215
Originally posted by: Tyler
Originally posted by: BamBam215
Originally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
not a programming class 🙂
So?
so even though u've proven you're very l33t in programming, that doesn't help me with the problem.
Um, do you know what that does? It takes a list of prime numbers and tells you which ones, when muliplied by 5 and incremented by 1, are perfect squares. That doesn't help with your problem?
Originally posted by: her209
x^2 = 5p + 1
does that help? 😛
(x^2 - 1) / 5 = p
(x+1)(x-1) / 5 = p
Originally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
It says, given an array of primes, go through each one and multiply each one by 5 and add 1 to it. Then take the square root. If the answer is a whole number, then 5p+1 is a perfect square. :beer:Originally posted by: OrganizedChaos
glad i'm not a programmer, i don't understand how you people can stand to look at that jibberishOriginally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
Basically, any perfect square that ends with a 1 or 6 satisfies that equation.Originally posted by: her209
x^2 = 5p + 1
does that help? 😛
(x^2 - 1) / 5 = p
I.e., at least one of the terms, (x+1) or (x-1), is a multiple of 5 and not 0.(x+1)(x-1) / 5 = p
Originally posted by: OrganizedChaos
Originally posted by: Tyler
use Math::Complex;
foreach $p(@list_of_primes){
$q = 5 * $p;
$q++;
$q = sqrt($q);
if(int($q) == $q){
print "$p is print and 5($p)+1 is a perfect square\n";
}
}
}
glad i'm not a programmer, i don't understand how you people can stand to look at that jibberish
Originally posted by: Tyler
use Math::Complex; foreach $p(@list_of_primes){ $q = 5 * $p; $q++; $q = sqrt($q); if(int($q) == $q){ print "$p is print and 5($p)+1 is a perfect square\n"; } } }
Originally posted by: dighn
ok 5P+1 is a perfect square
lets see
5P + 1 = n^2, n = 1,2,3,4,5...
now all prime numbersw are whole numbers, so P must be whole
P = (n^2-1)/5
for it to be whole, n^2-1 must be divisible by 5 that is end in 0 or 5
n^2 end in 1 or 6
now expand n into the form a*10 + b, where a = 0,1,2,3..9 b = 0,12,3,..9 etc
n^2 = 100a^2 + 20ab + b^2 <-- note that first two terms contribut enothing to
the oneth place, only b^2 does, so b^2 must end in 1
b must be 1,4,6,9
so now
P = (n^2-1)/5 = ((10a+b)^2-1)/5 = (10a+b+1)(10a+b-1)/5
b is 1, 4,6,9
P = (10a+2)(10a)/5 = 2a(10a+2) for b = 1 --> this cant be prime
P = (10a+5)(10a+3)/5 = (2a+1)(10a+3) for b =4 -->a must be 0 for it to be prime, P = 3
P = (10a+7)(10a+5)/5 = (10a+7)(2a+1) for b = 6 --> a must be 0 for prime, P = 7
P = (10a+10)(10a+8) for b = 9 ---> cannot be prime
only answers are 3 and 7
P = (10a+5)(10a+3)/5 = (2a+1)(10a+3) for b =4 -->a must be 0 for it to be prime, P = 3
P = (10a+7)(10a+5)/5 = (10a+7)(2a+1) for b = 6 --> a must be 0 for prime, P = 7
Originally posted by: RaynorWolfcastle
I nice proof, except I'm not too sure these steps are right
P = (10a+5)(10a+3)/5 = (2a+1)(10a+3) for b =4 -->a must be 0 for it to be prime, P = 3
P = (10a+7)(10a+5)/5 = (10a+7)(2a+1) for b = 6 --> a must be 0 for prime, P = 7
if you multiply out the case b = 4, you get 20a^2 + 16a + 3 = P.
and for b = 6, you get 20a^2 + 24a + 7 = P.
Please explain how you can state that all a's except 0 are not prime, maybe I'm missing something obvious.
for b = 4, P = (2a+1)(10a+3)
u have 2 whole numbers multipleid together, that's not gonna be a prime unless one of the is a 1, 10a+3 cannot be 1, 2a+1 can only be 1 if a is = 0, same with for b = 6