Original author: David Ahl

Description: Nearly all of us has seen some mathematical formulas with what is possible to solve a number what other person is thinking at. In some formulas, that other person is asked to multiply, divide etc. that number for few times and then, we can solve number he or she is thinking at.
Arithmetica of Nicomachus is oldest known of these. It is also extremely easy one too. Probably easiest one that is known this far.
This program uses arithmetica of Nicomachus to solve out what number you are thinking between '1' to '100'.

' =============================================
' =               Nicomachus                  =
' = Creative Computing Morristown, New Jersey =
' =============================================

'    Remade for FreeBASIC by E.K.Virtanen.
'    Public Domain

Dim As Integer A, B, C, D
Dim AS String YesNo, Message

Screen 12
    Color 14, 0
    Print Tab(33); "Nicoma"
    Print Tab(15); "Creative Computing Morristown, New Jersey"
    Print ""
    Color 15, 0
    Print Tab(15); "Ported to FreeBASIC by E.K.Virtanen 2007."
    Print Tab(25); ""
    Print ""
    Print "Boomerang puzzle from Arithmetica of Nicomachus -- A.D. 90!"
    Print "Please think of a number between '1' and '100'..."
    Input "Your number divided by '3' has remainder of "; A
    Input "Your number divided by '5' has remainder of "; B
    Input "Your number divided by '7' has remainder of "; C
        D = (70 * A + 21 * B + 15 * C)

            If D > 104 Then D = (D - 105)
        Loop Until D <= 105

    Print "Your number was "; D; ", right? (Y/N): ";
        Input YesNo
    Message = "Eh...can't you just say 'Y' or 'N'?"
    If Ucase(YesNo) = "Y" Then Message = "Magic or math... ;)"
    If Ucase(YesNo) = "N" Then Message = "I think it's up to your math skills then ;)"
    YesNo = ""
    Print ""
    Print Message
    Print ""
    Print "Now, press 'Y' if you want to try again. Any other key to quit program."
    Do : YesNo = Inkey$ : Loop Until YesNo <> ""
Loop While Ucase(YesNo) = "Y"
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.