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

Home > Just Math
Representation Initiation (Posted on 2014-05-26) Difficulty: 3 of 5
The base ten integer 839 has the representations 1132 and 11324 respectively in base 9 and base 5. Accordingly, 839 has a base 5 representation that begins with its base 9 representation.

For which other base ten integers between 10 and 2014 inclusively do the base 5 representation of the integer begin with its base 9 representation?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
 For n = 10 To 200000
   b5$ = base$(n, 5)
   b9$ = base$(n, 9)
   If InStr(b5$, b9$) = 1 Then
     Text1.Text = Text1.Text & Str(n) & "   " & b5$ & "   " & b9$ + crlf
     DoEvents
   End If
 Next

End Sub

Function base$(n, b)
  v$ = ""
  n2 = n
  Do
    d = n2 Mod b
    n2 = n2 \ b
    v$ = LTrim(Str(d)) + v$
  Loop Until n2 = 0
  base$ = v$
End Function

attempts n through 200,000, but finds all the valid numbers under 2000:

        base
   10     5       9
  ------------------ 
  839   11324   1132
  840   11330   1133
  894   12034   1203
  895   12040   1204
  900   12100   1210
 1739   23424   2342
 1740   23430   2343
 1794   24134   2413
 1795   24140   2414
 1800   24200   2420


  Posted by Charlie on 2014-05-26 16:47:35
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
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