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

Home > Just Math
Four Digit Trial (Posted on 2014-06-05) Difficulty: 3 of 5
N is a 4-digit positive integer such that the sum of the four digits of N equals the product of the first two digits of N and also equals the product of the last two digits of N.

Find all N's and prove there are no others.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
DefDbl A-Z
Dim crlf$



Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
 
 For n = 1000 To 9999
   ns$ = LTrim(Str(n))
   p1 = Val(Mid(ns$, 1, 1)) * Val(Mid(ns$, 2, 1))
   p2 = Val(Mid(ns$, 3, 1)) * Val(Mid(ns$, 4, 1))
   If p1 = p2 Then
     s = sod(n)
     If s = p1 Then
       Text1.Text = Text1.Text & n & crlf
     End If
   End If
   
 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

finds

3636
3663
4444
6336
6363

It checks all four-digit numbers.


  Posted by Charlie on 2014-06-05 16:41:56
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 (11)
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