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

Home > Numbers
Special Number (Posted on 2004-06-30) Difficulty: 3 of 5
An integer N consisting of five distinct nonzero digits has the curious property that it is equal to the sum of all the different three-digit integers formed by the three digit permutations of its five digits. Find N.

See The Solution Submitted by np_rt    
Rating: 2.6667 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution | Comment 2 of 9 |

I'm assuming all digits must be different, so there are no repeated digits. Nonetheless, assume we have 60 possible three digit numbers available from the the initial five digit number. This is the permutation 5!/(5-3)!.

Now the tricky part. I didn't feel like writing code to brute-force the entire thing. So, I did a little deduction to determine an easier formula. If there are 60 possible three digit numbers and 5 digits, each digit in the five-digit number must appear 12 times in each order of magnitude to give all possible three-digit numbers. This gives you the notion that (1200+120+12) times the sum of the individual digits must be equal to the five-digit number. The only two solutions that work according to my code are 0 (which is illegal) and 35964.

#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
     long int number = 0;
     for(int i = 0; i < 100000; i++)
     {
         int e = i % 10;
         int x = i / 10;
         int d = x % 10;
         x = x / 10;
         int c = x % 10;
         x = x / 10;
         int b = x % 10;
         x = x / 10;
         int a = x;
         int y = a + b + c + d + e;
         if (y*1332 == i){
             cout << i;
             getchar();
         }    
     }    
}
  Posted by Eric on 2004-06-30 09:34:21
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 (6)
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