Post: Program that computes the largest prime number ever
05-18-2011, 06:27 AM #1
0xFa1z
Splicer
(adsbygoogle = window.adsbygoogle || []).push({}); Hey guys

This small C script can compute 2^43112609-1 which is the biggest ever known prime number (13 million digits)

    int m=167772161,N=1,t[1<<25]={2},a,*p,i,e=34893349,s,c,U=1;g(d,h){for(i=s;i<1<<
24;i*=2)d=d*1LL*d%m;for(p=t;p<t+N;p+=s)for(i=s,c=1;i;i--)a=p[s]*(h?c:1LL)%m,p[s]
=(m+*p-a)*(h?1LL:c)%m,a+=*p,*p++=a%m,c=c*1LL*d%m;}main(){while(e/=2){N*=2;U=U*
1LL*(m+1)/2%m;for(s=N;s/=2Winky Winkyg(17,0);for(p=t;p<t+N;p++)*p=*p*1LL**p%m*U%m;for(s=1
;s<N;s*=2)g(29606852,1);for(a=0,p=t;p<t+NWinky Winkya+=*p<<(e&1),*p++=a%10,a/=10;}while(!
*--p);for(t[0]--;p>=tWinky Winkyputchar(48+*p--);}

You must compile it using a C compiler that supports 64 bit long long type and it will take 2 minutes on a 2.3 ghz CPU



Impress your math teachers :p
(adsbygoogle = window.adsbygoogle || []).push({});
05-19-2011, 09:11 PM #11
Stop flaming each other. If you have nothing nice to say, keep it to yourself.

This goes for everyone in here.

The following user thanked Racketeer 2.0 for this useful post:

Relevant
05-19-2011, 09:11 PM #12
kiwimoosical
Bounty hunter
Originally posted by ox3 View Post
To be honest, i don't really care, I'm stating the obvious.

kiwimoosical, was i speaking to you? and i know how to compile it, its just that most other people on the forum do not, you are the stupid one.


So your saying that most people on this forum can't follow these simple steps:

1. Ctrl+C
2. Ctrl+V into IDE
3. F5

Basically you are saying this whole forum has down syndrome. You're not stating the obvious, you're making a jackass of yourself. He told everyone exactly what it does, must be 64 bit OS, takes average of 2 minutes. Get off his nuts troll.
05-20-2011, 08:36 PM #13
0xFa1z
Splicer
I didnt find this on google, my prof showed this to me, so i thought i might share it, thats how much info he gave me on it, so really i dont know who really wrote it either.
05-21-2011, 07:47 PM #14
Finally a mod in this section, Josh flames every single damn post n this section.
05-21-2011, 09:26 PM #15
vSaBoTeuR x
< ^ > < ^ >
Originally posted by ox3 View Post
To be honest, i don't really care, I'm stating the obvious.

kiwimoosical, was i speaking to you? and i know how to compile it, its just that most other people on the forum do not, you are the stupid one.


If you're (grammar? CHECK) stating the obvious, please use correct grammar, or you will look like an ass. Thank you.

Originally posted by Relevant View Post
Finally a mod in this section, Josh flames every single damn post n this section.


Thank you! Finally someone who is not supporting the damn flaming.

The following 2 users say thank you to vSaBoTeuR x for this useful post:

0xFa1z, Relevant

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo