mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   Mersenne Prime # of Digits Calculator (https://www.mersenneforum.org/showthread.php?t=10596)

Jeff Gilchrist 2008-08-31 01:05

Mersenne Prime # of Digits Calculator
 
1 Attachment(s)
Most of you here already know how to calculate this but for those of you that don't, I threw together a quick program that will calculate the number of decimal digits in a specified Mersenne number (2^p-1).

There are Windows binaries available (GUI and command line), plus source code for the command line version to compile on Linux/Unix systems.

You can download the software from:
[URL="http://gilchrist.ca/jeff/MprimeDigits/"]http://gilchrist.ca/jeff/MprimeDigits/[/URL]

Jeff.

Uncwilly 2008-08-31 02:58

Great idea. Maybe someone can throw together a Java version of this.

retina 2008-08-31 03:18

Also, maybe do the reverse, allow the user to enter the decimal digits and compute the binary equivalent.

R. Gerbicz 2008-08-31 07:30

[QUOTE=Jeff Gilchrist;140473]I threw together a quick program that will calculate the number of decimal digits in a specified Mersenne number (2^p-1).
[/QUOTE]

Your program is broken:
[code]
Mersenne Prime # Digits Calculator v1.0 [Aug. 30, 2008]
by Jeff Gilchrist (http://gilchrist.ca/jeff/)

This program will calculate the number of decimal digits in
the specified Mersenne number 2^p-1.

Enter the value of p to calculate: 100000000000000000039

Number of decimal digits in 2^7766279631452241959-1 is: 2337883123781333504
[/code]

Batalov 2008-08-31 07:43

This tool can also be used (with minor modifications) to calculate number of Mb in a hard-drive-maker's Terabyte and/or Gigabyte, and maybe even number of millions of bytes in a Mb. Just don't take my comment too seriously. It is a useful tool.

Batalov 2008-08-31 08:08

1 Attachment(s)
[quote=Uncwilly;140477]Great idea. Maybe someone can throw together a Java version of this.[/quote]
Java? Why waste Java for that. Javascript will do. Just drop this code in a "digits.html" file on your desktop and click on it
[CODE]<HTML><HEAD><TITLE>Conversion Exponent/Digits JavaScript</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1251">
<SCRIPT language=JavaScript>
<!--
function DigitsExp(){document.convert.Digits.value = document.convert.Exponent.value*0.301029995664;}
function ExpDigits(){document.convert.Exponent.value = document.convert.Digits.value/0.301029995664;}
//-->
</SCRIPT>
<META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD>
<BODY text=#fExpDigitsc03 vLink=#ffffff link=#ffffff bgColor=#000000>
<CENTER>
<TABLE cellPadding=5 border=1><TBODY><TR><TD>
<FORM name=convert>
<H1>Mersenne Prime Digits</H1>
<INPUT onblur=DigitsExp(); onfocus="document.convert.Digits.value='';" maxLength=10 size=10 value=0 name=Exponent>
<FONT size=+2>Exponent</FONT>
<INPUT onclick=DigitsExp(); type=button value=">>"> <INPUT onclick=ExpDigits(); type=button value="<<">
<FONT size=+2>Digits</FONT>
<INPUT onblur=ExpDigits(); onfocus="document.convert.Exponent.value='';" maxLength=10 size=10 name=Digits> </FORM></TR></TBODY>
</TABLE>
</BODY>
</HTML>[/CODE]
--Serge

dsouza123 2008-08-31 15:40

1 Attachment(s)
A Delphi (Pascal) Windows console mode version.
It agrees with a ubasic version for the first 18 digits
after that it just it puts zeros, at least with a 20 digit p.
With p <= 18 digits the results agree with the numbers I've tested.

Delphi :

Enter the value of p in 2^p - 1
(with p maximum 18 digits, for good results) : 100000000000000000039
2^100000000000000000000 - 1 has 30102999566398119500 decimal digits.

UBasic :

Enter the value of p in 2^p - 1
(with p maximum xx digits, for good results) : ? 100000000000000000039
2^ 100000000000000000039 - 1 has 30102999566398119532 decimal digits.

[CODE]
Program BiDecDig;
var
power2 : extended;
power10 : extended;
x : extended;
y : extended;
z : extended;
s : string;

begin
power2 := 32582657.0; // The example value used in the 1st post in the thread

writeln('Enter the value of p in 2^p - 1');
write ('(with p maximum 18 digits, for good results) : ');
readln(power2);

x := ln(2.0);
y := ln(10.0);
z := ((x/y) * power2) + 1.0;
power10 := int(z);
writeln('2^',power2:0:0,' - 1 has ',power10:0:0,' decimal digits.');
readln(s);
end.
[/CODE]

The ubasic source code.
[CODE]
100 print "Enter the value of p in 2^p - 1"
110 input "(with p maximum xx digits, for good results) : ";Power2
120 X=log(2)
140 Y=log(10)
160 Z=((X/Y)*Power2)+1.0
180 Power10=fix(Z)
200 print "2^";Power2;"- 1 has";Power10;"decimal digits."
[/CODE]

The UBasic version may be accurate to hundreds of digits but
I don't have any way to test it.

Delphi source and executable and UBasic source
are in the attachment BiDecDig.zip

Jeff Gilchrist 2008-09-01 00:56

[QUOTE=R. Gerbicz;140480]Your program is broken:
[/QUOTE]

It is not really broken, more that it only supports 64bit integers so the largest p value you can enter is: 18446744073709551616

Luckily I didn't leave it as 32bit ints. :tu:

Are you trying to figure out what kind of primes your great grandchildren will be testing? :wink:

Jeff.

Batalov 2008-09-01 02:04

I think what we need now is a parody on the "programmer's progression" joke (the Hello World program progression from Basic to Fortan, Algol, Pascal, Cobol, PL/SQL, Ada and [URL="http://en.wikipedia.org/wiki/Brainfuck"]brainf*ck[/URL] ... and beyond)

Who is game to write the BF implementation? :lol:

davieddy 2008-09-01 13:11

Personally speaking, a conversion factor of log[sub]10[/sub]2
serves my purposes well enough.

R. Gerbicz 2008-09-01 15:43

[QUOTE=Jeff Gilchrist;140536]It is not really broken, more that it only supports 64bit integers so the largest p value you can enter is: 18446744073709551616

Luckily I didn't leave it as 32bit ints. :tu:

Are you trying to figure out what kind of primes your great grandchildren will be testing? :wink:

Jeff.[/QUOTE]

There are numbers less than 2^64 for which your program is bad:
for example: p=28505944177 (this p is prime)
or for p=198096465 (this p is composite) gives bad number of digits for 2^p-1

Jeff Gilchrist 2008-09-01 16:45

[QUOTE=R. Gerbicz;140574]There are numbers less than 2^64 for which your program is bad:
for example: p=28505944177 (this p is prime)
or for p=198096465 (this p is composite) gives bad number of digits for 2^p-1[/QUOTE]

Are you sure? The manual calculation for p=28505944177 gives me:
8581144252.0000000003405805164701

My program is reporting 8581144253 since it is slightly larger the 8581144252. Same for the p=198096465, the manual calculation gives 59632978.000000002598316594477929 where my programs gives 59632979.

So what am I missing?

R. Gerbicz 2008-09-01 18:27

1 Attachment(s)
[QUOTE=Jeff Gilchrist;140586]
So what am I missing?[/QUOTE]

See my results.
My machine is P4 Celeron, 32 bits.

biwema 2008-09-01 18:31

Why not just multiply the input by 0.301029995663981195213738894724493 (Log10 2), add 1 and remove the decimal places.

Maybe too many logarithms would increase the rounding error.

R.D. Silverman 2008-09-02 14:39

[QUOTE=Jeff Gilchrist;140473]Most of you here already know how to calculate this but for those of you that don't, I threw together a quick program that will calculate the number of decimal digits in a specified Mersenne number (2^p-1).

.[/QUOTE]

I mean nothing personal toward you, but I think your code is a big
mistake.

I see it as a furtherance of the 'dumbing down of America'. i.e.
Let's not require that people learn how to do it, but instead provide a
tool that will do their thinking for them. If people participating in this
forum do not know how to do the calculation, then they should either
learn it or leave. They have no place here, IMO. The math involved
is simple 2nd year high school level math. (basic concepts about
change-of-base in logarithms).

Uncwilly 2008-09-02 17:02

[QUOTE=R.D. Silverman;140640]I mean nothing personal toward you, but I think your code is a big mistake.

I see it as a furtherance of the 'dumbing down of America'. i.e.
Let's not require that people learn how to do it, but instead provide a
tool that will do their thinking for them.[/QUOTE]By this statement I will assume that you drive a Model T and maunally advance the spark, use a manual transmission, only use hard copy maps, never use speed dial, write all of your code in machine language (using edlin), etc. There are many tools that we use in everyday life that, "do the 'thinking'" for us. Should base changing be taught in HS? Yes.

R.D. Silverman 2008-09-02 17:34

[QUOTE=Uncwilly;140657]By this statement I will assume that you drive a Model T and maunally advance the spark, use a manual transmission, only use hard copy maps, never use speed dial, write all of your code in machine language (using edlin), etc. There are many tools that we use in everyday life that, "do the 'thinking'" for us. Should base changing be taught in HS? Yes.[/QUOTE]


"This" is not "everyday life". "This" is the mersenneforum; a place
devoted to the study and discussion of mathematics.

Joining the club means paying the dues. Here, paying the dues
means having a basic understanding of mathematics.

If one is interested enough in Mersenne primes to want to compute the
decimal length of 2^p-1, then one should be interested enough to
learn how it works.

It is like giving a spell&grammer-checker to 2nd graders; the result is people
who can't write or spell.....

Uncwilly 2008-09-02 17:50

[QUOTE=R.D. Silverman;140664]If one is interested enough in Mersenne primes to want to compute the decimal length of 2^p-1, then one should be interested enough to learn how it works.[/QUOTE]Correct, if someone is a regular reader of this forum, they can if they wish, learn how to do this calc. They should, but I won't force them to.

Don't get me started on spelling & grammar.

R.D. Silverman 2008-09-02 18:13

[QUOTE=Uncwilly;140668]Correct, if someone is a regular reader of this forum, they can if they wish, learn how to do this calc. They should, but I won't force them to.

Don't get me started on spelling & grammar.[/QUOTE]

I won't force them either. I will just treat their willful ignorance
with unbridled contempt.

drew 2008-09-03 06:52

[QUOTE=R.D. Silverman;140676]I won't force them either. I will just treat their willful ignorance
with unbridled contempt.[/QUOTE]

What about those of us who already know how to perform the calculation? Should we not use software to make it simpler for us? Should I derive my own logarithm tables myself?

Batalov 2008-09-03 06:58

1 Attachment(s)
Young people have no idea. And don't even get me started on the printed tables! (believe it - we used them is school... and I am not even that old... "Таблицы Брадиса", high school, early 80-s, paper, black paint, oil. Nah, wait a minute, oil is from the breakfast sandwich... Oh, found some - [URL]http://bradis-table.narod.ru/table/mantissy.html[/URL] . I will save you a trip to the museum. Observe the line with 2.0 => 0.3010 )

S485122 2008-09-03 10:32

[QUOTE=drew;140734]What about those of us who already know how to perform the calculation? Should we not use software to make it simpler for us? Should I derive my own logarithm tables myself?[/QUOTE]I would not like to install a tool just for dividing a number by the logarithm of 2 in base 10 and rounding up. Because if I start like that, I would end up with an ever increasing collection of thousands of different tools.

The tool is clearly intended for a public that does not know how to compute the number of digits of a number in a particular base and has not enough knowledge (to be polite) to learn it.

I can not even find the excuse that it would be useful for the people reporting primes in non Mersenne related searches on the forum because the tool is too specialised.

One positive thing to it set a few people to program ;-)

Jacob

R.D. Silverman 2008-09-03 11:24

[QUOTE=drew;140734]What about those of us who already know how to perform the calculation? Should we not use software to make it simpler for us? Should I derive my own logarithm tables myself?[/QUOTE]

What's the matter? Is a hand calculator too complicated a tool for you?
If you know how to do the calculation, then a specialized program
is not needed. Nor is it any faster.

Jeff Gilchrist 2008-09-03 15:51

1 Attachment(s)
[QUOTE=R. Gerbicz;140574]There are numbers less than 2^64 for which your program is bad:
for example: p=28505944177 (this p is prime)
or for p=198096465 (this p is composite) gives bad number of digits for 2^p-1[/QUOTE]

You are absolutely right. It seems there were some rounding errors which I have now fixed so hopefully everything will be accurate now. Thank you for finding those problems so I could fix them.

I have now released v1.1 available from:
[url]http://gilchrist.ca/jeff/MprimeDigits[/url]

New in v1.1:[LIST][*]Fixed rounding errors reported by R. Gerbicz.[*]Command line version now accepts multiple p values on the command line (ie: mprimedigits 32582657 25964951)[*]Now displays formula used to calculate # of digits so people can better understand how to calculate it themselves if they wish.[/LIST]
As for Dr. Silverman's comments, I originally wrote this program for myself just to make it easier to calculate with 1 button push instead of several, but I figured others on the Internet in general would be interested as well so it is now available for anyone to use. In order to help people learn if they wish, I have now included the formula the program uses as a starting point for them instead of it being a complete black hole.

Jeff Gilchrist 2008-09-03 15:53

[QUOTE=R.D. Silverman;140750]What's the matter? Is a hand calculator too complicated a tool for you?
If you know how to do the calculation, then a specialized program
is not needed. Nor is it any faster.[/QUOTE]

Well it is faster in the sense that with my program you can use a script to pass it multiple values to calculate at once, giving you all the results in probably the same amount of time it would take to use a hand calculator for one number.

ewmayer 2008-09-03 16:10

Using the unix/linux bc utility [or a decent electronic calculator with any form of a "log" function], it's trivial: start "bc -l" [the -l flag invokes floating-point mode], then

[your exponent here]*l(2)/l(10)

..and round up. The -1 subtracted from the 2^p in the real Mersenne number is nearly always ignorable if the the digit count is large - you'd only need to include it if the above result is really, really close to a whole number. ["How close" makes for a nice homework assignment.]

Example: for p = 32582657, the above gives 9808357.095430986538..., which is not close to a whole number in the relevant sense, so we round confidently up and get 9808358 decimal digits for M44.

lavalamp 2008-09-03 17:27

[QUOTE=ewmayer;140779]The -1 subtracted from the 2^p in the real Mersenne number is nearly always ignorable[/QUOTE]For a Mersenne number it is always ignorable, since 2^n mod 10 can only equal 2, 4, 6 or 8.

Edit: When finding the number of digits for a number such as 5^n*2^n - 1 though, the minus one does matter.

R. Gerbicz 2008-09-03 23:49

1 Attachment(s)
[QUOTE=Jeff Gilchrist;140776]
I have now released v1.1[/QUOTE]

For large inputs your program is still bad (see the picture).

My c solution for the problem, no trick, not using built in large math libraries:
( it should be good for p<10^40 )
[code]
#include <stdio.h>
#include <string.h>


int main() {

int A[40],B[100],R[141],carry,valid,i,j,L;
char input[64],w[101]="3010299956639811952137388947244930267681898814621085413104274611271081892744245094869272521181861720";

while(1) {
printf("Please input an exponent (at most 40 digits) : ");
scanf("%s",input);
L=strlen(input);
valid=1;
for(i=0;i<L;i++)
if((input[i]<'0')||(input[i]>'9')) valid=0;
if((valid==0)||(L>40)) printf("Invalid input!\n");
else break;
}

for(i=0;i<L;i++) A[i]=input[L-1-i]-'0';
for(i=0;i<100;i++) B[i]=w[99-i]-'0';
for(i=0;i<141;i++) R[i]=0;
// grammar school multiplication
for(i=0;i<L;i++)
for(j=0;j<100;j++) R[i+j]+=A[i]*B[j];

R[100]++;
carry=0;
for(i=0;i<=140;i++) {
carry+=R[i];
R[i]=carry%10;
carry/=10;
}

i=140;
while(R[i]==0) i--;
printf("The number of decimal digits of 2%c%s%c1 is ",'^',input,'-');
while(i>=100) printf("%d",R[i]),i--;
printf("\n");
return 0;
}
[/code]

jrk 2008-09-04 02:03

[quote=R. Gerbicz;140805][code]char input[64][/code][code]scanf("%s",input);[/code][/quote]
Careful with that. You don't want to write more than 64 bytes to "input".

akruppa 2008-09-04 10:10

On a side note, if you want to do the (approximate) conversion with pencil and paper, a useful fact to remember is that
[B]F[sub]12[/sub][/B] has [B]1234 [/B]decimal digits.

Conveniently, the leading digits of F12 are 104..., so 2^4096 is pretty close to 10^1233, and the estimate
log(10)/log(2) ~= 4096/1233 = 3.3219...
is reasonably accurate. From the continued fraction expansion the better fraction 2136/643 = 3.321928... can be found, but it's not as easy to remember.

Alex

R.D. Silverman 2008-09-04 12:03

[QUOTE=akruppa;140825]On a side note, if you want to do the (approximate) conversion with pencil and paper, a useful fact to remember is that
[B]F[sub]12[/sub][/B] has [B]1234 [/B]decimal digits.

Conveniently, the leading digits of F12 are 104..., so 2^4096 is pretty close to 10^1233, and the estimate
log(10)/log(2) ~= 4096/1233 = 3.3219...
is reasonably accurate. From the continued fraction expansion the better fraction 2136/643 = 3.321928... can be found, but it's not as easy to remember.

Alex[/QUOTE]

Also, the utility of this tool somehow eludes me. Why would someone
who doesn't know how to do the calculation need to know how many
digits 2^p-1 has?

xilman 2008-09-04 12:14

[QUOTE=R.D. Silverman;140836]Also, the utility of this tool somehow eludes me. Why would someone
who doesn't know how to do the calculation need to know how many
digits 2^p-1 has?[/QUOTE]You are confusing "need" and "want".

An adequate justification for wanting to know is idle curiosity.


Paul

R.D. Silverman 2008-09-04 12:27

[QUOTE=xilman;140837]You are confusing "need" and "want".

An adequate justification for wanting to know is idle curiosity.


Paul[/QUOTE]

Not where I work.............:smile:

drew 2008-09-04 15:57

[QUOTE=R.D. Silverman;140839]Not where I work.............:smile:[/QUOTE]

Why would anyone *need* to know how many decimal digits the number has? Decimal representation is very inconvenient for computational purposes, and these numbers are much too big for the human mind to comprehend.

So aside from idle curiosity, what possible purpose could the information serve?

mdettweiler 2008-09-04 15:58

[quote=drew;140849]Why would anyone *need* to know how many decimal digits the number has? Decimal representation is very inconvenient for computational purposes, and these numbers are much too big for the human mind to comprehend.

So aside from idle curiosity, what possible purpose could the information serve?[/quote]
News articles, perhaps, announcing the latest big Mersenne prime find? :grin:

retina 2008-09-04 16:00

[QUOTE=drew;140849]Why would anyone *need* to know how many decimal digits the number has?[/QUOTE]So that they can see if they have won one of the EFF prizes.

drew 2008-09-04 16:35

[QUOTE=retina;140851]So that they can see if they have won one of the EFF prizes.[/QUOTE]

That's much easier. The exponent just needs to be greater than 33219281.

retina 2008-09-04 16:40

[QUOTE=drew;140853]That's much easier. The exponent just needs to be greater than 33219281.[/QUOTE]Well sure, but how would one know that without computing it? Hence the program "binary digit count to decimal digit count converter for dummies". Besides there is more than one EFF prize outstanding, so the exponent depends upon which prize one is claiming.

FactorEyes 2008-09-04 16:50

Different Version Needed
 
This is all well and good, but it would be more useful to me if it displayed how many bits in the Mersenne number, instead of decimal digits. Can we get added functionality to do this?

:help:

retina 2008-09-04 16:57

[QUOTE=FactorEyes;140857]This is all well and good, but it would be more useful to me if it displayed how many bits in the Mersenne number, instead of decimal digits. Can we get added functionality to do this?

:help:[/QUOTE]Hmm, tricky, but perhaps this:[code]#include <stdio.h>
#include <string.h>

int main() {

char input[9999999999]

printf("Please input an exponent (at most 9999999999 digits) : ");
scanf("%s",input);
printf("The number of binary digits of 2%c%s%c1 is %s\n",'^',input,'-',input);
return 0;
}[/code]Untested, so use at your own risk!

FactorEyes 2008-09-04 17:21

[QUOTE=retina;140858]Hmm, tricky, but perhaps this:[code]#include <stdio.h>
#include <string.h>

int main() {

char input[9999999999]

printf("Please input an exponent (at most 9999999999 digits) : ");
scanf("%s",input);
printf("The number of binary digits of 2%c%s%c1 is %s\n",'^',input,'-',input);
return 0;
}[/code]Untested, so use at your own risk![/QUOTE]It's gotten to the point that you can't make a joke on an internet forum anymore. Sigh.

Thanks for the code, though.

ewmayer 2008-09-04 17:30

I cannot believe such a trivial computation has gotten this much electronic ink ... actually, I can belive it, I just don't want to.

Jeff Gilchrist 2008-09-04 17:34

[QUOTE=ewmayer;140862]I cannot believe such a trivial computation has gotten this much electronic ink ... actually, I can belive it, I just don't want to.[/QUOTE]

I guess my secret plan for writing this program to foster discussion on whether such a program should be written or not has worked! :grin:

xilman 2008-09-04 17:43

[QUOTE=retina;140858]Hmm, tricky, but perhaps this:[code]#include <stdio.h>
#include <string.h>

int main() {

char input[9999999999]

printf("Please input an exponent (at most 9999999999 digits) : ");
scanf("%s",input);
printf("The number of binary digits of 2%c%s%c1 is %s\n",'^',input,'-',input);
return 0;
}[/code]Untested, so use at your own risk![/QUOTE]In fine old Usenet tradition:

YHBT
YHL
HTH
HAND


Paul

xilman 2008-09-04 17:48

[QUOTE=R.D. Silverman;140839]Not where I work.............:smile:[/QUOTE]Despite what I've read somewhere, "Seek and ye shall find" is not uniformly successful.

"An adequate justification for wanting to know is idle curiosity." doesn't imply that your curiosity will be satisfied or even worth pursuing.

(I know, I'm wasting my time on idle vaporings when I could be doing something more useful, but what the heck.)


Paul

davieddy 2008-09-05 14:22

[quote=ewmayer;140862]I cannot believe such a trivial computation has gotten this much electronic ink ... actually, I can belive it, I just don't want to.[/quote]
And if the "-1" in "2^p-1" ever became crucial an adequate
approximation is available.

akruppa 2008-09-05 14:43

It can't. For the -1 to change the number of decimal digits, we'd need that the trailing decimal digit is 0 which implies 5|2^p. (I take both 0 and 1 to have one digit so the case 2^0-1 is ok)

Alex

cheesehead 2008-09-05 22:08

Looking for other ways for math-challenged folks
 
Following up on an article

"Really how smart are search engines?" at [URL]http://www.instantfundas.com/2007/09/really-how-smart-are-search-engines.html[/URL]

[quote]It's already known that Google has the ability to do mathematical calculation and function just like a calculator. But Google isn't alone. Ask.com and Yahoo can do simple math too.[/quote] I find that Google can compute 2^n-1 up to n=1023 -- to only 9 significant digits, but that should be enough to get the power-of-10 even after subtracting 1.

A Google search on "2^1023-1" produces: [quote][B][SIZE=4](2^1[/SIZE][SIZE=4]023) - 1 = 8.98846567 × 10[sup]307[/sup][/SIZE][/B][/quote](Apparently Google figures that folks seeking such numbers might also be nearsighted.)

For "2^607-1", Google comes up with: [quote][B][SIZE=4](2^607) - 1 = 5.31137993 × 10[sup]182[/sup][/SIZE][/B][/quote]So, for the first 14 Mersenne primes, Google is a possibility.

Yahoo, upon being presented with "2^7-1" gives: [quote]
[B][B]2^7-1 = 127[/B][/B]

[/quote]... but only after showing you some "Also trys" and a sponsor result (and gambling that you're not quite as nearsighted as Google allows for).

However, upon seeing "2^607-1", it gives [quote][B]2^607-1 = 5.31137993E+182[/B][/quote]right at the top, both crediting you with understanding of the "E" notation and avoiding the possibility that cut-n-paste will, as with Google, flatten out the right-most part to "[B][SIZE=4]× 10182[/SIZE][/B]" if the quoter isn't diligent about re-inserting the [ sup ] and [ /sup ] formatting as I did above.

Yahoo, like Google, tops out at 2^1023-1, as far as giving simple numeric answers.

Ask.com apparently isn't up to exponentiation yet. An ask.com search on "2^7-1" produces the pitiful: [quote]Your search for [B]2^7-1[/B] did not match with any Web results.[/quote](Really? No one on the Whole World Wide Web has ever posted a page with the character string "2^7-1"? C'mon!)

FactorEyes 2008-09-24 01:05

Deadpan request
 
Also it would be helpful to display the number of 1's in the binary expansion of a given Mersenne number.

retina 2008-09-24 02:10

[QUOTE=FactorEyes;143588]Also it would be helpful to display the number of 1's in the binary expansion of a given Mersenne number.[/QUOTE]Maybe it could print all the 1's in a nice X by Y box format and make sure there are no ugly gaps. Preferably X and Y should be greater than 1.

Batalov 2008-09-24 02:45

[quote=cheesehead;141026]...Ask.com apparently isn't up to exponentiation yet. An ask.com search on "2^7-1" produces the pitiful:
[SIZE=2]Your search for [B]2^7-1[/B] did not match with any Web results.[/SIZE]
(Really? No one on the Whole World Wide Web has ever posted a page with the character string "2^7-1"? C'mon!)[/quote]

...and so does this forum's "Search"! :smile:

At least here the gerbil's ghosts earnestly* warn you
"Prepare to be disappointed."

________________________________
*earnestly ([I]sic[/I]!). Quite honestly, too.

petrw1 2008-09-24 19:58

I just use this...

[url]http://www.mersenne.org/bench.htm[/url]

stars10250 2008-12-21 19:53

Is there a calculator that will show me the full number if I provide the Mersenne exponent?

Jeff Gilchrist 2008-12-21 19:55

[QUOTE=stars10250;154444]Is there a calculator that will show me the full number if I provide the Mersenne exponent?[/QUOTE]

Yes, the "bc" tool found in UNIX and cygwin will do that.

CRGreathouse 2008-12-21 20:04

[QUOTE=stars10250;154444]Is there a calculator that will show me the full number if I provide the Mersenne exponent?[/QUOTE]

Well, there's Pari/GP...

lavalamp 2008-12-21 20:19

[QUOTE=CRGreathouse;154447]Well, there's Pari/GP...[/QUOTE]I've tried that, it seems fine to hold it in memory, but if I tell it to output to the screen or as a text file, it just hangs.

CRGreathouse 2008-12-21 20:34

[QUOTE=lavalamp;154449]I've tried that, it seems fine to hold it in memory, but if I tell it to output to the screen or as a text file, it just hangs.[/QUOTE]

For what size of numbers? For example, does this work?
write("foo.txt", 2^43112609-1)

I can't give comparative timing as I'm having issues with my hard drive at the moment.

Mini-Geek 2008-12-21 21:01

Use mprint: [URL]http://www.apfloat.org/apfloat/mprintc5.zip[/URL]
Pari could probably do it, but for something as large as M45, as you've seen, it would take so long that it seems to hang (or might actually hang).

stars10250 2008-12-21 21:25

Cool, thanks!...mprint worked great. Of course, it got kinda dull after the first few thousand pages of numbers!

R. Gerbicz 2008-12-21 23:46

[QUOTE=stars10250;154444]Is there a calculator that will show me the full number if I provide the Mersenne exponent?[/QUOTE]

In base 2 it's trivial.

James Heinrich 2008-12-22 02:30

[QUOTE=Batalov;140482]Java? Why waste Java for that. Javascript will do. Just drop this code in a "digits.html" file on your desktop and click on it
--Serge[/QUOTE]Hopefully you have no objections -- I have placed a copy of your code here:
[url]http://mersenne-aries.sili.net/digits.php[/url]

stars10250 2008-12-22 20:10

Question: I ran mprint on the largest number I'm currently testing. I imported the output file into MSWord, and at 10 point it took up 3159 pages. Then, for fun, I searched the file for interesting numbers such as pie, e, and numbers like 555555, or 111111. I found that I could always find any number sequence of my choosing up to about 6 digits, but any more digits and I didn't always find the sequence (some numbers went to 8 digits but not always). Is this a measure of randomness? Meaning, does it take a number of this size such that one can pick out any 6 sequential digits and be sure they are random? If so, does the number of random digits relate to the size of the exponent and how? I'm kind of surprised it takes a number this big to get 6 random digits. I know there must also be some sort of allowance for the particular numbers that make up this given exponent, but I believe this observation is likely true within a digit or so. Comments appreciated.

Xyzzy 2008-12-22 20:33

The following thread might be somewhat related to the questions you have asked.

[url]http://www.mersenneforum.org/showthread.php?t=5414[/url]

Freightyard 2008-12-24 07:37

Dang mathematicians! Ya gotta take something simple and complex-it to death!

Congrats to Gilchrist for writing a simple utility. Perhaps a float or double type would solve the problem with integer limits? I second the motion for a two-way calculator.

R.D.Silverman--you aren't, perhaps, a *nix user are you? Keeping "unworthy" people out of the club when GIMPS is hoping to gain interest and participants doesn't sound like the best idea. How about EXPLAINING the math instead?


All times are UTC. The time now is 23:28.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.