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

Home > Just Math
Digital power (Posted on 2008-11-15) Difficulty: 2 of 5
Find all numbers N = a1a2a3...an greater than 1, with no leading zeros, no zeros, which fits this equation:

N = a1a1 + a2a2 + a3a3 + ... + anan

Clarifying, N = 23 doesn´t work because 22 + 33 is equal to 31, not 23.

See The Solution Submitted by pcbouhid    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Second Computer Solution | Comment 2 of 6 |
During our review process I composed the following listing using QuickBasic.   Variable 'pp' was provided to avoid "wide scale" edits.  'm' was provide only for the purpose of screen display.

I had an issue of seeking to overcome "0^0", or 0º, which  I ultimately resolved that with the If statements.

The program displayed three results, for sum1 - sum2, 0,0; 1;1 and 3435,3435.  As 0º has no relevance, and "1" has been ruled out by the problem text the only valid result found is 3435.

I note Charlie has been instructive as to  why this value is unique.

Incidentally, the "time$" variable (one of which has been deleted) showed a runtime of some 100 minutes in processing the 10^9 For...next loops.

I'm not claiming this as my solution as I was aware of pcbouhid's value before hand; I actually set out to see if there was a unique solution as defined by the problem.

CLS
 pp = 9
 m = 2


 FOR g = 0 TO pp
    IF g = 0 THEN z = 0 ELSE z = g ^ g
 FOR f = 0 TO pp
    IF f = 0 THEN y = 0 ELSE y = f ^ f
 FOR e = 0 TO pp
     IF e = 0 THEN x = 0 ELSE x = e ^ e
 FOR d = 0 TO pp
     IF d = 0 THEN w = 0 ELSE w = d ^ d
 FOR c = 0 TO pp
     IF c = 0 THEN v = 0 ELSE v = c ^ c
 FOR b = 0 TO pp
     IF b = 0 THEN u = 0 ELSE u = b ^ b
 FOR a = 0 TO pp
     IF a = 0 THEN t = 0 ELSE t = a ^ a

 sum1 = g * 10 ^ 6 + f * 10 ^ 5 + e * 10 ^ 4 + d * 10 ^ 3 + c * 10 ^ 2 + b * 10 + a
 sum2 = z + y + x + w + v + u + t
 IF sum1 = sum2 THEN
 LOCATE 2 + m: PRINT sum1; sum2; TIME$
 m = m + 1
 END IF
 NEXT: NEXT: NEXT: NEXT: NEXT: NEXT: NEXT


  Posted by brianjn on 2008-11-15 20:48:36
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 (14)
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