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

Home > Numbers
I Got Your Number (Posted on 2004-04-18) Difficulty: 3 of 5
Lou Zerr is trying to pick up a woman at a bar. The woman, Denise, is reluctant to give out her number, but she gives Lou a clue.

"My sister, Elise and I have the same digits in our phone numbers, just in reverse order. Elise's number is also evenly divisible by mine."

What is Denise's phone number?

(Note: this IS NOT a real exchange, as far as I know. Assume the phone number has 10 digits: 7 digit number + 3 digit area code.)

No Solution Yet Submitted by Bob Genisot    
Rating: 3.6000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Another non-trivial solution | Comment 3 of 15 |

Denise's number: (108) 900-1089 

Elise's number: (980) 100-9801 

This was turned up quickly by the following Visual Basic console application program, when I specified 1000000001 as the starting number for the search. The program avoids trivial solutions. In about 9 days I should have all non-trivial solutions.

Imports System
Imports System.Runtime.InteropServices
Imports System.Math
Module Module1
    Dim strNumberWork As String
    Dim dblNumberWork As Double
    Dim strDigitWork As String
    Dim dblNumericPlace As Double
    Dim strNumericPlace As String
    Dim dblIntervalCount As Double
    Dim dblTotalCount As Double
    Dim dblSubtract3 As Double
    Dim dblSubtract1 As Double
    Dim dblSubtract2 As Double
    Dim dblRandomNumber As Double
    Dim dblTensWorkarea As Double
    Dim strTensWorkarea As String
    Dim dblRightmostDigit As Double
    Dim strRightmostDigit As String
    Dim strEndFlag As String
    Dim dblBeginNumber As Double
    Sub Main()
        Randomize()
        dblIntervalCount = 0
        dblTotalCount = 0
        strEndFlag = "X"
        dblBeginNumber = 0
        While ((dblBeginNumber = 0) Or _
        (dblBeginNumber > 9999999999))
            Console.WriteLine("Where shall we begin? Please enter a phone number")
            dblBeginNumber = Int(Console.ReadLine())
        End While
        For Index1 As Double = dblBeginNumber To 9999999999
            dblRandomNumber = Index1
            ' Bypass the number Tristan already found.
            If dblRandomNumber = 2199999978 Then
                dblRandomNumber += 1
            End If
            dblNumericPlace = 10000000000
            dblNumericPlace += dblRandomNumber
            strNumericPlace = Str(dblNumericPlace)
            strDigitWork = strNumericPlace.Substring(2, 1)
            dblNumberWork = (10 ^ 0) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(3, 1)
            dblNumberWork += (10 ^ 1) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(4, 1)
            dblNumberWork += (10 ^ 2) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(5, 1)
            dblNumberWork += (10 ^ 3) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(6, 1)
            dblNumberWork += (10 ^ 4) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(7, 1)
            dblNumberWork += (10 ^ 5) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(8, 1)
            dblNumberWork += (10 ^ 6) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(9, 1)
            dblNumberWork += (10 ^ 7) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(10, 1)
            dblNumberWork += (10 ^ 8) * Int(strDigitWork)
            strDigitWork = strNumericPlace.Substring(11, 1)
            dblNumberWork += (10 ^ 9) * Int(strDigitWork)
            dblIntervalCount += 1
            dblTotalCount += 1
            If dblTotalCount = 1 Then
                Console.WriteLine("Beginning with " & _
                 Str(dblRandomNumber) & " " & Str(dblNumberWork))
            End If
            If dblIntervalCount > 9999999 Then
                dblIntervalCount = 0
                Console.WriteLine("So far we have examined " & _
                  Str(dblTotalCount) & " phone numbers")
                Console.WriteLine("The last phone number we considered, " & _
                "and its reverse, were: ")
                Console.WriteLine(Str(dblRandomNumber) & _
                " " & Str(dblNumberWork))
            End If
            If dblNumberWork >= dblRandomNumber Then
                dblSubtract1 = dblNumberWork
                dblSubtract2 = dblRandomNumber
            Else
                dblSubtract1 = dblRandomNumber
                dblSubtract2 = dblNumberWork
            End If
            dblTensWorkarea = 10000000000
            dblTensWorkarea += dblSubtract1
            strTensWorkarea = Str(dblTensWorkarea)
            strRightmostDigit = strTensWorkarea.Substring(11, 1)
            dblRightmostDigit = Int(strRightmostDigit)
            If (dblSubtract1 <> dblSubtract2) And _
              (dblRightmostDigit <> 0) Then
                While dblSubtract1 > 0
                    dblSubtract1 -= dblSubtract2
                End While
                If dblSubtract1 = 0 Then
                    strEndFlag = "0"
                    Console.WriteLine("  ")
                    Console.WriteLine("GOT A HIT !!!!!!!")
                    Console.WriteLine("HERE THEY ARE: " & _
                    Str(dblRandomNumber) & " " & _
                    Str(dblNumberWork))
                    While (strEndFlag <> "N" And strEndFlag <> "Y")
                        Console.WriteLine("  ")
                        Console.WriteLine("Do you wish to continue ? Y/N")
                        strEndFlag = UCase(Console.ReadLine())
                    End While
                End If
            End If
            If strEndFlag = "N" Then
                Exit For
            End If
        Next Index1
        Console.WriteLine("  ")
        Console.WriteLine("Please Press Enter to End Program")
        Console.ReadLine()
    End Sub
End Module

Edited on April 19, 2004, 9:13 am
  Posted by Penny on 2004-04-19 07:08:05

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 (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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