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

Home > Numbers
Some definite results (Posted on 2015-09-17) Difficulty: 3 of 5
Find the possible outcomes of the following algorithm:

1.Take a random positive integer, divisible by three.
2.Consider its base 10 digits.
3.Take the sum of their cubes.
4.Go back to step 2.

Rem: You may limit your research for n<1000.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
re: non-analytic solution | Comment 4 of 5 |
(In reply to non-analytic solution by Paul)

I also do not know much about Ruby, but my Basic solution finds that at most 13 iterations are required to reach 153. Perhaps what you found is that 14 iterations are required to get two successive numbers that are equal; that is, to get the second 153.


DefDbl A-Z
Dim crlf$


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

 For n = 3 To 10000 Step 3
   DoEvents
  ' Text1.Text = Text1.Text & n & "    "
   n1 = n
   For iter = 1 To 15
     ns$ = LTrim(Str(n1))
     n1 = 0
     For i = 1 To Len(ns)
       v = Val(Mid(ns, i, 1))
       n1 = n1 + v * v * v
     Next
    ' Text1.Text = Text1.Text & Str(n1)
     If n1 = 153 Then Exit For
     DoEvents
   Next iter
   If iter > 12 Then Text1.Text = Text1.Text & n & Str(n1) & Str(iter) & crlf
   
  '  Text1.Text = Text1.Text & crlf & crlf
 Next

 Text1.Text = Text1.Text & crlf & n & " done"
  
End Sub

Column 1 of the following list shows the starting numbers that require 13 iterations. The other columns merely verify that 153 has been reached and that 13 is the number of iterations. Any number of iterations greater than 12 are reported and only 13's show up.

177 153 13
717 153 13
771 153 13
1077 153 13
1707 153 13
1770 153 13
4467 153 13
4476 153 13
4647 153 13
4674 153 13
4677 153 13
4746 153 13
4764 153 13
4767 153 13
4776 153 13
4779 153 13
4797 153 13
4977 153 13
6447 153 13
6474 153 13
6477 153 13
6744 153 13
6747 153 13
6774 153 13
7017 153 13
7071 153 13
7107 153 13
7170 153 13
7446 153 13
7464 153 13
7467 153 13
7476 153 13
7479 153 13
7497 153 13
7644 153 13
7647 153 13
7674 153 13
7701 153 13
7710 153 13
7746 153 13
7749 153 13
7764 153 13
7794 153 13
7947 153 13
7974 153 13
9477 153 13
9747 153 13
9774 153 13

  Posted by Charlie on 2015-09-18 08:27:49
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 (16)
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