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

Home > Just Math
Sum Productive Digits (Posted on 2014-12-31) Difficulty: 3 of 5
N is a positive integer. S(N) denotes the sum of digits of N and P(N) denotes the product of digits of N.

Determine the values of N given that: N = 2*S(N)*P(N)

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 solutions Comment 2 of 2 |
Private Sub Form_Load()
 ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
 


 For n = 4 To 10000000 Step 4
   If n = 2 * sod(n) * pod(n) Then
     Text1.Text = Text1.Text & n & crlf
   End If
     DoEvents
 Next
End Sub
 
 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 pod(n)
   s$ = LTrim(Str(n))
   prod = 1
   For i = 1 To Len(s$)
    prod = prod * Val(Mid(s$, i, 1))
   Next
   pod = prod
 End Function
 
finds three solutions:

12
216
432

  Posted by Charlie on 2014-12-31 12:14:30
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 (12)
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