mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Math

Reply
 
Thread Tools
Old 2004-11-21, 19:45   #1
Unregistered
 

2,039 Posts
Default how do you find number of digits of a 2^n number?

hi all,
I found this program yesterday and i was thinking about how to tell how many digits are in a 2^n number if i knew n. I made a Microsoft Excel spreadsheet and calculated out about 40 sequences, and eventually found a pattern relating the n's that end in 0 (multiples of 10). my pattern was ((3/10)*n) + 1. for example, using 0 for n, the result (number of digits in 2^n) is 1, as it should be. using 10, 20, 30, and 40 for n, i get 4, 7, 10, 13 respectively. i checked the actual digits by doing the math on the calculator and counting digits, and the pattern works. i found this page http://www.utm.edu/research/primes/mersenne/index.html which showed a table of known mersenne primes. i tested my equation on the table, and got good results until n=1279. according to the chart, 2^n should have 386 digits. however, when i plugged it into my equation, i came up with 384 digits. each n after that also gave incorrect answers, and they get continually worse. for example, the 40th mersenne prime, 2^20996011 -1 has 6,320,430 digits according to the chart, but only 6,298,804 digits according to my equation (i used n=20996010 to get the answer, because i found a pattern that shows that after a multiple of 10, the next 3 have the same amount of digits, followed by 3 with 1 more digit, another 3 with 2 more digits, and then the next multiple of 10 is reached).
So, i was wondering how you guys got the number of digits in a 2^n number, and why my equation and the "known" digits are so far off.

thanks in advance,
michael

p.s. if you don't understand what i wrote, say so and i'll try to clarify.
  Reply With Quote
Old 2004-11-21, 19:53   #2
marc
 
marc's Avatar
 
Jun 2004
UK

139 Posts
Default

floor(log 2 * n) + 1

Where log is base 10.
marc is offline   Reply With Quote
Old 2004-11-21, 19:55   #3
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

11011111101102 Posts
Default

There are ceiling (n * log10(2)) digits. The base 10 log of 2 is .30103
Prime95 is online now   Reply With Quote
Old 2004-11-21, 20:01   #4
Unregistered
 

5×359 Posts
Default

ah, that makes sense. now i see why mine are so close at the beginning and then so far off later on.
but then, another quick question--what do floor and ceiling mean?
  Reply With Quote
Old 2004-11-21, 20:08   #5
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

2×3×1,193 Posts
Default

floor is round down. ceiling is round up.
Prime95 is online now   Reply With Quote
Old 2004-11-21, 20:10   #6
Unregistered
 

298410 Posts
Default

ah, got it. thanks
  Reply With Quote
Old 2004-11-22, 16:31   #7
Jwb52z
 
Jwb52z's Avatar
 
Sep 2002

3×257 Posts
Default

Are floor and ceiling terms simply the same thing as the boundaries of the logarithmic functions?
Jwb52z is offline   Reply With Quote
Old 2004-11-22, 19:39   #8
marc
 
marc's Avatar
 
Jun 2004
UK

139 Posts
Default

They're just "functions".

floor refers to the integer that is closest to a number without being higher. ceiling refers to the integer that is closest to a number without being lower.

They're just fancy names for rounding up and rounding down.
marc is offline   Reply With Quote
Old 2004-11-23, 05:30   #9
dave_0273
 
dave_0273's Avatar
 
Oct 2003
Australia, Brisbane

1110101102 Posts
Default

I don't know about other languages.. but I know that I use floor and ceiling a lot in both excel and matlab. Both floor and ceiling are acual "functions" in both programs. However, I haven't actually ever seen floor or ceiling written in any maths textbooks as far as I can remember... I could be wrong though.
dave_0273 is offline   Reply With Quote
Old 2004-11-23, 09:08   #10
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

2·3·1,699 Posts
Default

Quote:
Originally Posted by dave_0273
I don't know about other languages.. but I know that I use floor and ceiling a lot in both excel and matlab. Both floor and ceiling are acual "functions" in both programs. However, I haven't actually ever seen floor or ceiling written in any maths textbooks as far as I can remember... I could be wrong though.
In printed text the floor and ceiling functions are generally written as partial square brackets. I don't know that I can include the characters here, but they look something like this:

floor(x) is represented by |_ x _| and ceiling(x) has the horizontal lines at the top.


Paul
xilman is offline   Reply With Quote
Old 2004-11-23, 18:02   #11
cheesehead
 
cheesehead's Avatar
 
"Richard B. Woods"
Aug 2002
Wisconsin USA

22×3×599 Posts
Default

See

http://mathworld.wolfram.com/FloorFunction.html and

http://mathworld.wolfram.com/CeilingFunction.html

for clear examples and fuller explanation.
cheesehead is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
who can help me factor this 155 digits number sinide Factoring 12 2010-11-09 01:05
who can factor this 128 digits number? aaa120 Factoring 19 2010-09-04 09:16
Number Of Digits; I Hate To Ask storm5510 Other Mathematical Topics 14 2010-08-31 01:16
Factoring 132-digits Number abc_temp Factoring 14 2007-12-23 20:25
Number of digits display grobie 15k Search 13 2005-09-29 21:57

All times are UTC. The time now is 03:55.

Fri Nov 27 03:55:43 UTC 2020 up 78 days, 1:06, 4 users, load averages: 1.24, 1.26, 1.37

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.