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

 Year from Ratio (Posted on 2016-08-22)
S denotes the sum of the digits and P denotes the product of the nonzero digits.
It is observed that for the year 2016, S = 9 and P = 12, so that:
S:P = 3:4

Determine all years from 2000 to 3000 such that:
S:P = 3:4

 No Solution Yet Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: No Subject Comment 3 of 3 |

2016 and 2061 are missing from your list; of course the former was present in the puzzle itself, but not the latter.

`year sod pod(nz)2004   6   82016   9  122022   6   82040   6   82061   9  122106   9  122118  12  162160   9  122181  12  162202   6   82220   6   82400   6   82601   9  122610   9  122811  12  16`

from

DefDbl A-Z
Dim crlf\$

Form1.Visible = True

Text1.Text = ""
crlf = Chr\$(13) + Chr\$(10)

For y = 2000 To 2999
DoEvents
If 4 * sod(y) = 3 * podnz(y) Then
Text1.Text = Text1.Text & y & mform(sod(y), "###0") & mform(podnz(y), "###0") & crlf
End If
Next

Text1.Text = Text1.Text & crlf & " done"

End Sub

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 sod(n)
s\$ = LTrim(Str(n))
tot = 0
For i = 1 To Len(s\$)
tot = tot + Val(Mid(s\$, i, 1))
Next
sod = tot
End Function

Function podnz(n)
s\$ = LTrim(Str(n))
tot = 1
For i = 1 To Len(s\$)
If Mid(s, i, 1) <> "0" Then tot = tot * Val(Mid(s\$, i, 1))
Next
podnz = tot
End Function

 Posted by Charlie on 2016-08-23 19:52:39

 Search: Search body:
Forums (0)