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

Home > Numbers
Palindrome in 4 steps (Posted on 2018-06-06) Difficulty: 3 of 5
I took a certain 3-digit number, reversed it, got another 3-digit number, and added the two.
The sum was not a palindrome.
I repeated the process, which resulted in another 3-digit number that was still not a palindrome.
Repeating the process twice more I got a 4-digit number, which was a palindrome finally.

What was the 3-digit number we started with the second time?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts computer findings (spoilers) | Comment 1 of 4
In each of the five cases below, the initial starting number is in the first column and successive results, which, except for the last, are new starting numbers, appear in the remaining columns.

Assuming "the 3-digit number we started with the second time" means one of the numbers in column 2, it could be 483, 362 or 382.


192 483 867 1635 6996
280 362 625 1151 2662
290 382 665 1231 2552
291 483 867 1635 6996
390 483 867 1635 6996


DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 For n = 100 To 999
  If isPalin(n) = 0 Then
   ns$ = LTrim(Str(n))
   rs$ = ""
   For i = 1 To Len(ns)
     rs = Mid(ns, i, 1) + rs
   Next
   r = Val(rs)
   tot = n + r: tot1 = tot
   If isPalin(tot) = 0 Then
     tots$ = LTrim(Str(tot))
     rs = ""
     For i = 1 To Len(tots)
       rs = Mid(tots, i, 1) + rs
     Next
     tot = tot + Val(rs): tot2 = tot
     If tot < 1000 And isPalin(tot) = 0 Then
     
        tots$ = LTrim(Str(tot))
        rs = ""
        For i = 1 To Len(tots)
          rs = Mid(tots, i, 1) + rs
        Next
        tot = tot + Val(rs): tot3 = tot
        If isPalin(tot) = 0 Then
        
            tots$ = LTrim(Str(tot))
            rs = ""
            For i = 1 To Len(tots)
              rs = Mid(tots, i, 1) + rs
            Next
            tot = tot + Val(rs)
            If isPalin(tot) = 1 And tot > 999 Then
              Text1.Text = Text1.Text & n & Str(tot1) & Str(tot2) & Str(tot3) & Str(tot) & crlf
            End If
        
        
        End If
     
     End If
   End If
  End If
 Next
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

Function isPalin(n)
 s$ = LTrim(Str(n))
 
 good = 1

 For i = 1 To Len(s$) / 2
   If Mid$(s$, i, 1) <> Mid$(s$, Len(s$) + 1 - i, 1) Then good = 0: Exit For
 Next
 
 isPalin = good
End Function


Function mform$(x, t$)
  a$ = Format$(x, t$)
  If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
  mform$ = a$
End Function


  Posted by Charlie on 2018-06-06 12:31:27
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 (18)
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