All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Pythagorean Plus One (Posted on 2004-05-17) Difficulty: 3 of 5
A "Pythagorean Plus One" triple can be defined as any three distinct integers a, b, c, such all three of these are one more than a perfect square, and also a times b equals c. What is the lowest value of c possible?

See The Solution Submitted by Gamer    
Rating: 2.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Solution | Comment 2 of 20 |

The three smallest c's are 10 (2,5,10), 50 (5,10,50) and 170 (10,17,170)

Visual Basic program used (with apologies to Charlie for my Dim-wittedness):

Imports System
Imports System.Runtime.InteropServices
Imports System.Math
Module Module1
    Sub Main()
        Randomize()
        Dim intIntervalCount As Integer
        Dim dblIntervalTotal As Double
        Console.WriteLine("Starting program execution at " & _
        TimeOfDay)
        intIntervalCount = 0
        dblIntervalTotal = 0
        For IndexC As Integer = 1 To 999
            For IndexA As Integer = 1 To 999
                If IndexA <> IndexC Then
                    For IndexB As Integer = 1 To 999
                        If IndexB <> IndexA And IndexB <> IndexC Then
                            DoTheMath(IndexA, IndexB, IndexC, _
                               intIntervalCount, dblIntervalTotal)
                        End If
                    Next
                End If
            Next
        Next
        Console.WriteLine(" ")
        Console.WriteLine("Ending program execution at " & _
        TimeOfDay)
        Console.WriteLine(" ")
        Console.WriteLine("Please press ENTER to exit program...")
        Console.ReadLine()
    End Sub


    Sub DoTheMath(ByVal IndexA, ByVal IndexB, ByVal IndexC, _
    ByRef intIntervalCount, ByRef dblIntervalTotal)
        Dim dblWorkareaC As Double
        Dim dblWorkareaA As Double
        Dim dblWorkareaB As Double
        Dim strContinueFlag As String
        intIntervalCount += 1
        dblIntervalTotal += 1
        If intIntervalCount >= 99999 Then
            intIntervalCount = 0
            Console.WriteLine("We are now on processing cycle " & _
            Str(dblIntervalTotal))
        End If
        dblWorkareaC = (IndexC ^ 2) + 1
        dblWorkareaA = (IndexA ^ 2) + 1
        dblWorkareaB = (IndexB ^ 2) + 1
        If dblWorkareaC <> dblWorkareaA * dblWorkareaB Then
            Exit Sub
        End If
        Console.WriteLine("Hi Pythagoras !!")
        Console.WriteLine(" ")
        Console.WriteLine(Str(dblWorkareaA) & " " & _
                          Str(dblWorkareaB) & " " & _
                          Str(dblWorkareaC))
        Console.WriteLine(" ")
        strContinueFlag = "?"
        While (strContinueFlag <> "Y" And strContinueFlag <> "N")
            Console.WriteLine("Do you wish to continue ? (Y/N)")
            strContinueFlag = UCase(Console.ReadLine())
        End While
        If strContinueFlag = "N" Then
            End
        End If
    End Sub
End Module


  Posted by Penny on 2004-05-17 09:11:09
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information