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

Home > Numbers
One, two, eight etc (Posted on 2015-05-22) Difficulty: 2 of 5
List all the numbers (below 4000) that their Roman numeral representations have the same number of letters as their squares.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution adding overbars for large squares Comment 2 of 2 |
(In reply to computer solution not considering overlining for large squares by Charlie)

Adding code to allow for overbarred numerals, the list expands considerably.  Fortunately, 1000, either as M or an overbarred I, still is one character so it doesn't affect the count.  In the below, for the squares of 32 - 39, the same numbers appear below in a different manner, but the same character count.  I've put the overbarred letters on the left, followed by a space and then the non-barred letters, but the space doesn't count in the character count. In some cases there is/are only overbarred letters; so if there is no space and the square is over 1000, be assured all the letters should be overbarred, such as X for 10000, the square of 100 (C) or M for 1,000,000, the square of M for 1,000.  
  
     1        1   I               I
     2        4   II              IV
     8       64   VIII            LXIV
    10      100   X               C
    20      400   XX              CD
    23      529   XXIII           DXXIX
    32     1024   XXXII           I XXIV
    34     1156   XXXIV           I CLVI
    38     1444   XXXVIII         I CDXLIV
    39     1521   XXXIX           I DXXI
    71     5041   LXXI            V XLI
    80     6400   LXXX            VI CD
    84     7056   LXXXIV          VII LVI
    98     9604   XCVIII          IX DCIV
   100    10000   C               X 
   148    21904   CXLVIII         XXI CMIV
   200    40000   CC              XL 
   227    51529   CCXXVII         LI DXXIX
   230    52900   CCXXX           LII CM
   237    56169   CCXXXVII        LVI CLXIX
   238    56644   CCXXXVIII       LVI DCXLIV
   243    59049   CCXLIII         LIX XLIX
   245    60025   CCXLV           LX XXV
   246    60516   CCXLVI          LX DXVI
   253    64009   CCLIII          LXIV IX
   320   102400   CCCXX           CII CD
   331   109561   CCCXXXI         CIX DLXI
   332   110224   CCCXXXII        CX CCXXIV
   338   114244   CCCXXXVIII      CXIV CCXLIV
   340   115600   CCCXL           CXV DC
   380   144400   CCCLXXX         CXLIV CD
   381   145161   CCCLXXXI        CXLV CLXI
   389   151321   CCCLXXXIX       CLI CCCXXI
   390   152100   CCCXC           CLII C
   399   159201   CCCXCIX         CLIX CCI
   436   190096   CDXXXVI         CXC XCVI
   449   201601   CDXLIX          CCI DCI
   638   407044   DCXXXVIII       CDVII XLIV
   710   504100   DCCX            DIV C
   718   515524   DCCXVIII        DXV DXXIV
   742   550564   DCCXLII         DL DLXIV
   743   552049   DCCXLIII        DLII XLIX
   745   555025   DCCXLV          DLV XXV
   747   558009   DCCXLVII        DLVIII IX
   775   600625   DCCLXXV         DC DCXXV
   782   611524   DCCLXXXII       DCXI DXXIV
   800   640000   DCCC            DCXL 
   831   690561   DCCCXXXI        DCXC DLXI
   834   695556   DCCCXXXIV       DCXCV DLVI
   838   702244   DCCCXXXVIII     DCCII CCXLIV
   840   705600   DCCCXL          DCCV DC
   898   806404   DCCCXCVIII      DCCCVI CDIV
   980   960400   CMLXXX          CMLX CD
   998   996004   CMXCVIII        CMXCVI IV
  1000  1000000   M               M 
  1049  1100401   MXLIX           MC CDI
  1227  1505529   MCCXXVII        MDV DXXIX
  1245  1550025   MCCXLV          MDL XXV
  1248  1557504   MCCXLVIII       MDLVII DIV
  1253  1570009   MCCLIII         MDLXX IX
  1379  1901641   MCCCLXXIX       MCMI DCXLI
  1384  1915456   MCCCLXXXIV      MCMXV CDLVI
  1388  1926544   MCCCLXXXVIII    MCMXXVI DXLIV
  1397  1951609   MCCCXCVII       MCMLI DCIX
  1398  1954404   MCCCXCVIII      MCMLIV CDIV
  1416  2005056   MCDXVI          MMV LVI
  1468  2155024   MCDLXVIII       MMCLV XXIV
  1480  2190400   MCDLXXX         MMCXC CD
  1584  2509056   MDLXXXIV        MMDIX LVI
  1738  3020644   MDCCXXXVIII     MMMXX DCXLIV
  1871  3500641   MDCCCLXXI       MMMD DCXLI
  1888  3564544   MDCCCLXXXVII    MMMDLXIV DXLIV
  1898  3602404   MDCCCXCVIII     MMMDCII CDIV  
  
DefDbl A-Z
Dim crlf$
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
Function pad$(x$, l)
  pad$ = Left(x + Space$(l), l)
End Function


Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
     
    For i = 1 To 4000
     rm$ = roman(i)
     l = Len(rm$)
     sq = i * i
     If sq > 1000 Then
       pt1 = sq \ 1000: pt2 = sq Mod 1000
       pt1r$ = roman(pt1): pt2r$ = roman(pt2)
       l2 = Len(pt1r + pt2r)
       rmsq$ = pt1r + " " + pt2r
     Else
       l2 = Len(roman(sq))
       rmsq$ = roman(sq)
     End If
     If l = l2 Then
       Text1.Text = Text1.Text & mform(i, "#####0") & mform(i * i, "########0") & "   "
       Text1.Text = Text1.Text & pad(rm$, 12) & "    " & rmsq & crlf
     End If
     DoEvents
    Next
     
     
    Text1.Text = Text1.Text & "done" & crlf
End Sub

Function roman$(n)
  q = n \ 1000: r = n Mod 1000
ro$ = String$(q, "M")
n2 = r
q = n2 \ 100: r = n2 Mod 100
Select Case q
   Case 9: ro$ = ro$ + "CM"
   Case 5 To 8: ro$ = ro$ + "D" + String$(q - 5, "C")
   Case 4: ro$ = ro$ + "CD"
   Case 0 To 3: ro$ = ro$ + String$(q, "C")
End Select
n2 = r
q = n2 \ 10: r = n2 Mod 10
Select Case q
   Case 9: ro$ = ro$ + "XC"
   Case 5 To 8: ro$ = ro$ + "L" + String$(q - 5, "X")
   Case 4: ro$ = ro$ + "XL"
   Case 0 To 3: ro$ = ro$ + String$(q, "X")
End Select
n2 = r
q = n2
Select Case q
   Case 9: ro$ = ro$ + "IX"
   Case 5 To 8: ro$ = ro$ + "V" + String$(q - 5, "I")
   Case 4: ro$ = ro$ + "IV"
   Case 0 To 3: ro$ = ro$ + String$(q, "I")
End Select

roman$ = ro$

End Function
  

  Posted by Charlie on 2015-05-22 13:05: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 (3)
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