Largest Prime Number
Hi,
Because Excel switches to scientific notation does not mean the it can't
handle larger numbers or that its accuracy is only out to 11 places. In the
spreadsheet the accuracy could be out to 15 places just as the Help system
states. I say could because whether a result is accurate to 15 decimals
depends on what your calculating and you its handled in binary.
Cheers,
Shane Devenshire
"Joel" wrote:
Gary: I did some experimenting and I think the answer is 99999999977. Excel
says the accuracy is 15 places which I assume is binary which would mean that
the largest number is &HFFFF. I tried larger number and found the largest
number is 99999999999 (eleven 9's). Twelve 9's gave me scientific notation
which means the number was larger than the accuracy of excel.
I then wrote a quick program to find the largest number less than
99999999999. See program below.
Sub getprime()
Num = 99999999999#
Prime = 0
For N = Num To 1 Step -2
SqareRoot = Sqr(Num)
Prime = True
For N1 = 3 To SqareRoot step 2
Div = Int(N / N1)
Mult = Div * N1
If N = Mult Then
Prime = False
Exit For
End If
Next N1
If Prime = True Then
Prime = N
Exit For
End If
Next N
MsgBox ("Prime = " & Prime)
End Sub
"Gary''s Student" wrote:
What is the largest prime number that can be represented numerically in Excel?
I realize there are an infinite quantity of prime numbers, but I am not
concerned with primes that are so large that they can only be represented as
Text.
Thanks in advance.
--
Gary''s Student - gsnu200815
|