1
 |
tutz   Brasil. Sep 08 2010 11:24. Posts 2140 | | |
...that 999,999,191 and 999,999,193 are PRIME NUMBERS?
crazy shit ahm?
I made a simple program to find twin prime numbers and this is the biggest I found so far, haha
twin primes are pairs of primes which differ by two
if you want the code:
+ Show Spoiler +
|
|
| Last edit: 08/09/2010 18:10 |
|
|
1
 |
tutz   Brasil. Sep 08 2010 11:44. Posts 2140 | | |
|
|
1
 |
bigredhoss   Cook Islands. Sep 08 2010 11:47. Posts 8649 | | |
|
|
|
1
 |
JSquids   United States. Sep 08 2010 13:14. Posts 1142 | | |
|
AKA StarsNStripes@azeroth | |
|
|
4
 |
JonnyCosMo   United States. Sep 08 2010 13:59. Posts 7292 | | |
| On September 08 2010 12:14 JSquids wrote:
|
|
|
Everyone needs to see that you are king of the castle - PoorUser | |
|
|
1
 |
Twisted   Netherlands. Sep 08 2010 14:01. Posts 10422 | | |
I care very much about this. |
|
|
1
 |
tutz   Brasil. Sep 08 2010 14:10. Posts 2140 | | |
| On September 08 2010 13:01 Twisted wrote:
I care very much about this. |
thank you my good man |
|
|
1
 |
SPEWTARD   Peru. Sep 08 2010 15:10. Posts 4307 | | |
OMFG WOW MY LIFE JUST CHANGED |
|
|
|
1
 |
LsDDeaD   Bulgaria. Sep 08 2010 15:31. Posts 165 | | |
I must admit - I didn't knew that, but since your blog...everything's changed, thank you! |
|
|
1
 |
Ket   United Kingdom. Sep 08 2010 16:17. Posts 8665 | | |
Man I was just now thinking, I really wish I had the source code for a program that finds twin primes. That would make my life complete |
|
|
1
 |
Ezekiell   Hungary. Sep 08 2010 16:41. Posts 718 | | |
Jeez, that source code is really overcomplicated. Take a look at this:
public class PrimeNumber
{
public static boolean isPrime ( int num )
{
boolean prime = true;
int limit = (int) Math.sqrt ( num );
for ( int i = 2; i <= limit; i++ )
{
if ( num % i == 0 )
{
prime = false;
break;
}
}
return prime;
}
public static void main ( String[] args )
{
for ( int i = 2; i <= 1000000; i++ )
{
if ( isPrime ( i ) && isPrime (i+2) )
System.out.println ( i + " " + (i+2) );
}
}
}
And yes, im a geek  |
|
u got someone to call u with second top pair in headsup? | |
|
|
1
 |
taco   Iceland. Sep 08 2010 17:09. Posts 1793 | | |
+ Show Spoiler +
public class PrimeNumber
{
public static boolean isPrime ( int num )
{
boolean prime = true;
int limit = (int) Math.sqrt ( num );
for ( int i = 2; i <= limit; i++ )
{
if ( num % i == 0 )
{
prime = false;
break;
}
}
return prime;
}
public static void main ( String[] args )
{
for ( int i = 2; i <= 100000000; i++ )
{
if ( isPrime ( i ) && isPrime (i+2) )
System.out.println ( i + " " + (i+2) );
}
}
}
Mine is the same as Ezekiells, only better.
|
|
|
1
 |
tutz   Brasil. Sep 08 2010 17:13. Posts 2140 | | |
actualy my code is horrible |
|
| Last edit: 08/09/2010 17:52 |
|
|
1
 |
tutz   Brasil. Sep 08 2010 17:14. Posts 2140 | | |
and I also added a percentage counter to my code |
|
|
1
 |
EvilSky   Czech Republic. Sep 08 2010 17:17. Posts 8918 | | |
No I didnt, nor do I care now that I know. |
|
|
1
 |
player999   Brasil. Sep 08 2010 17:48. Posts 7978 | | |
Yes, I did know that.
I can do math without using silly tools to help, you know? |
|
Browsing through your hand histories makes me wonder that you might not be aware these games are possibly play money. Have you ever tried to cash out? - Kapol | |
|
|
1
 |
tutz   Brasil. Sep 08 2010 19:21. Posts 2140 | | |
this one is good
but still not great
import java.util.ArrayList;
public class Primos2 {
public static void main(String args[]) {
ArrayList<Integer> segList = new ArrayList<Integer>();
int y=1, z=0, w=0, x=0;
int a;
for (x=999999000; x<1000000000; x++) {
a = (int) (x/2);
z=0;
for (y=2; y<a; y++) {
if (x%y == 0) {
z++;
break;
}
}
if (z == 0) {
segList.add(x);
if (w>0) {
if ( ((int)segList.get(w-1)) == ((int)segList.get(w)) - 2 ) {
System.out.println(((int)segList.get(w-1))+" e "+((int)segList.get(w))+" ARE TWIN PRIMES!!!n" ;
}
}
w++;
}
}
}
} |
|
| Last edit: 08/09/2010 19:35 |
|
|
|