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

Home > Logic
Positive Integer and Power Puzzle (Posted on 2015-08-10) Difficulty: 3 of 5
N is a 6-digit positive integer whose sum of digits is 43.
Determine N, given that precisely one of the following statements is false:
  1. N is a perfect square
  2. N is a perfect cube
  3. N < 500000

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 solution | Comment 1 of 2
DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 For n = 100000 To 999999
  If sod(n) = 43 Then
    sr = Int(Sqr(n) + 0.5)
    If sr * sr = n Then t1 = 1 Else t1 = 0
    cr = Int(n ^ (1 / 3) + 0.5)
    If cr * cr * cr = n Then t2 = 1 Else t2 = 0
    If n < 500000 Then t3 = 1 Else t3 = 0
    If t1 + t2 + t3 = 2 Then
      Text1.Text = Text1.Text & n & crlf
    End If
  End If
 Next n


 
 Text1.Text = Text1.Text & crlf & " done"
  
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

499849
  Posted by Charlie on 2015-08-10 19:23:20
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 (8)
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