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

Home > Just Math
Shiny Numbers (Posted on 2013-06-20) Difficulty: 3 of 5
A positive integer is called shiny if it can be written as the sum of two not necessarily distinct integers a and b which have the same sum of their digits. For instance, 2012 is shiny, because 2012 = 2005 + 7, and both 2005 and 7 have the same sum of their digits. Find all positive integers which are not shiny (the dark integers).

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
based on a pattern | Comment 2 of 6 |

FOR n = 1 TO 99999999
    shiny = 0
    FOR a = 1 TO n / 2
        b = n - a
        IF sod(a) = sod(b) THEN shiny = 1: EXIT FOR
    NEXT
    IF shiny = 0 THEN PRINT n
NEXT
FUNCTION sod (x)
t = 0
s$ = LTRIM$(STR$(x))
FOR i = 1 TO LEN(s$)
    t = t + VAL(MID$(s$, i, 1))
NEXT
sod=t
END FUNCTION

finds

1
3
5
7
9
29
49
69
89
199
399
599
799
999
2999
4999
6999
8999
19999
39999
59999
79999
99999
...
etc. (program stopped manually at this point)

It would seem that an even number (including zero) of 9's  prefaced by an odd digit, or an odd number of 9's prefaced by an even digit, constitute the representations of such "dark numbers".


  Posted by Charlie on 2013-06-21 01:22:27
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 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information