Part 1:
There is a two digit number with the unique property that if a decimal point is inserted between the two digits, the resulting number is the average of the square of the digits.
Part 2:
There is a four digit number with the unique property that if a decimal point is inserted between the first and second digits, the resulting number is the average of the square of the digits.
What are these averages? Report your answers with the decimal point appropriately positioned, and include any trailing zeros, if any, to clearly indicate the number of digits present.
Bonus:
What about raising digits to integer powers higher than 2, different numbers of digits, and other locations of the decimal point? How many can you find?
For parts a and b the numbers are 20 and 4000 respectively, with 2.0 being the average of 4 and 0, the respective squares of 2 and 0. ... and 4.000 being the average of 16 and three zeros.
Too bad I started immediately with
For n = 10 To 99
sosd = 0
ns$ = LTrim(Str(n))
For i = 1 To Len(ns)
v = Val(Mid(ns, i, 1))
sosd = sosd + v * v
Next
If n * 2 = sosd * 10 Then
Text1.Text = Text1.Text & n & " " & Left(ns, 1) & "." & Mid(ns, 2) & crlf
End If
DoEvents
Next
For n = 1000 To 9999
sosd = 0
ns$ = LTrim(Str(n))
For i = 1 To Len(ns)
v = Val(Mid(ns, i, 1))
sosd = sosd + v * v
Next
If n * 4 = sosd * 1000 Then
Text1.Text = Text1.Text & n & " " & Left(ns, 1) & "." & Mid(ns, 2) & crlf
End If
DoEvents
Next
as a computer really shouldn't be necessary to find these answers. (But they do assure there are no other answers; these are indeed unique as the puzzle assures us.)
|
Posted by Charlie
on 2020-04-16 07:58:35 |