wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> hard >> 6 digit number...
(Message started by: h2 on May 16th, 2005, 9:59am)

Title: 6 digit number...
Post by h2 on May 16th, 2005, 9:59am
hi,

Im new to the forum, it looks good tho.
Anyway, ive got a riddle that very few people have acually solved yet, and I want to know if any of you guys can solve it, here it is...

I'm thinking of a 6-digit number. The sum of the digits is 43. And only two of the following three statements about the number are true:
(1) it's a square number.
(2) it's a cube number.
(3) the number is under 500000.

Title: Re: 6 digit number...
Post by towr on May 16th, 2005, 10:28am
The easy way to solve it would be to get a computer to try all possibilities (which isn't all that much)

Of course a more clever approach would be more satisfying.
One thing's for sure, it's not a multiple of 3.

Title: Re: 6 digit number...
Post by Sjoerd Job Postmus on May 17th, 2005, 5:54am
9+9+9+9 = 36... so it's easy to see that there are a maximum of 4 9's.
There's a maximum of 5 8's.
maximum of 5 7's, because 6*7 = 42, but can't have this.

77778 could be possible, though.

But, the first digit is < 5. Let's make it a four, and distribute the 3 among the last four digits, except the 8.

499993. would be the largest number satisfying the constraints.

Now, it might be clever to instead of walking through all numbers from 100000 to 500000, to walk from crt(100000) to crt(499993)... After all, it has to be a cube root, and a square root.

Programmatical approach:
FOR i = 46 TO 80 {
 int i;
 IF ( has_sqrt(cube(i)) && digsum(cube(i)) == 43) {
   ECHO cube(i);
 }
}

defining digsum:
digsum(int i) {
 int sum = 0;
 WHILE (i) {
   sum += i MOD 10;
   i = (i - (i MOD 10)) / 10;
 }
 return sum;
}

of course, this's pseudocode, and would only help if you would actually be prepared to code this.

Of course, I'm interested in this problem, as you can see... so I'll get out my compiler now ;)...

In fact, a really quick approach told me that cube(i) doesn't yield any results... Too bad :D :)

But, that solved the wrong riddle ;) But, it helped me with one result:

[hide]2)[/hide] is false. ;)

Boredom hit again...

[hide]7072 < 500000[/hide]

Title: Re: 6 digit number...
Post by SWF on May 17th, 2005, 8:27pm
All perfect cubes are either 0, 1, or 8 modulo 9, so the digits of a cube cannot add to 43. Thus, the number is perfect square less than 500000. The average digit must be pretty large, so start looking at the largest square less than 500000, which is 707*707 = 499849 (easy to do mentally if you know cos(45) = sqrt(.5) = .7071...).  Checking the digits shows they sum to 43 - no need to look further.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board