Thread: math riddle
View Single Post
Old 07-17-2008, 02:02 PM   #15
faulkner132
Come in Ray...
 
faulkner132's Avatar
 
Join Date: Sep 2004
Posts: 1,668
Quote:
Originally Posted by alpaca9000 View Post
Hey kasturi, I have a list of numbers but I've found over 100 answers, When I add them in Excel i get a number in scientific notation, how many digits was ur answer?
There are actually over 32,000 answers... the sum of them is 806546892372

You can paste this code into an Excel macro/VB window and run it to get the answer (this is the VBA "translation" for the pseudo-code I posted earlier):
Code:
Sub GetAnswer()
    Cells(1, 1).Value = Div13Sum(0)
End Sub

Function Div13Sum(ByVal ValueToTest As Long) As Double
    If ValueToTest < 999999 Then
        For i = 1 To 8
            Div13Sum = Div13Sum + Div13Sum((ValueToTest * 10) + i)
        Next
    Else
        If ValueToTest Mod 13 = 0 Then
            Div13Sum = ValueToTest
        Else
            Div13Sum = 0
        End If
    End If
End Function
faulkner132 is offline   Reply With Quote