You are invited to Log in or Register a free Frihost Account!

# Math Problem. 30 frih. (Solved!)

Xcelerate
Somewhat simple problem I solved recently to start out my math series, so only 30 frih:

a+b+c = 2006. a!b!c! = x*(10^n).

What is the largest possible value of n, where all variables are integers?

(If you recognize where this is from, don't say anything.)
TeenZine
 Xcelerate wrote: Somewhat simple problem I solved recently to start out my math series, so only 12 frih: a+b+c = 2006. a!b!c! = x*(10^n). What is the largest possible value of n, where all variables are integers? (If you recognize where this is from, don't say anything.)

I do it just give me a few min ok .
Xcelerate
I'll check you tomorrow.
Aredon
What is "a!b!c! = x*(10^n). "? Does that mean?
a != b != c != x(10^n)
Xcelerate
It means that a!b!c! can also be represented by another form:

x*(10^n).

As an example, if a = 5, b = 4, and c =3, then:

5!4!3! = (120 * 24 * 6) = 17280,

so this would be 1728 * 10^1, (1728 times 10 to the first) and n would equal 1.
benji2
50
Xcelerate
Not quite. A few hundred higher!
afracsass
500
Xcelerate
Closer! But it'll take you forever if you guess.
afracsass
I didn't guess
I computed the number of 5's for each factorial.
i'm sure that it must be larger than 500.

this time i'm guessing

501

 Xcelerate wrote: Closer! But it'll take you forever if you guess.
Aredon
Since integers can be both positive and negative, "infinity" is my answer.
Xcelerate
Factorials can't be negative, but good try.

I'll give you a hint:

Think of the three numbers that would produce the largest value when multiplied together.

-and-

Remember that in factorials 0s go up for every 5, so how many 0s would a 25! add?
Aredon
I started out with 668+668+669 = 2006.
Best I could factor it to without knowing any factorial factoring formulas:

n=log 669 + 3 log 668! - log x

log 668! can be broken down into:
log 668+log 667..... +log 1
so I resorted to JavaScript to solve it:
 Code:

and it told me:
2029.2027918289648

I did it in Perl too:
 Code: #!c:\Perl\bin\perl -w use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use bignum; print header; my \$i=0; for(\$i=1;\$i<=668;\$i++){ \$i+=log \$i; }; \$i*=3; \$i+=log 669; print \$i;

and it told me:
2029.2027918289642134198442130282412483570545

So the highest possible value for n is approximately 2029.2027918289642134198442130282412483570545 - log x.

I then tried another approach
 Code: #!c:\Perl\bin\perl -w use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use bignum; use Math::BigInt; use Math::BigInt lib => 'GMP'; my \$a = Math::BigInt->new("668"); \$a->bfac(); my \$b = Math::BigInt->new("668"); \$b->bfac(); my \$c = Math::BigInt->new("669"); \$c->bfac(); my \$total=Math::BigInt->new("1"); \$total->bmul(\$a); \$total->bmul(\$b); \$total->bmul(\$c); print header; print log(\$total);

and it told me:
11049.61290593895429944048838579558021754

So the highest possible value for n is 11049.61290593895429944048838579558021754 - log x.

I took the long route obviously and don't even know if I got it right.... I'd be interested in seeing the "shortcut".
Xcelerate
I don't think that's right, but another clever approach. I might as well give the solution so people don't get bored with this problem:

a+b+c = 2006. a!b!c! = x * 10^n.

Therefore, we need to find three values that will give the largest number when multiplied together, and they have to be integers. So the three closet you can get are:

668, 669, and 669.

Now, you need to figure out how many 0s are at the end of each factorial (this is part of the value of n). You know that 0s only get added whenever you have a 5 to multiply, but the trick here is that two 0s get added when you multiply by 25, and three 0s get added when you multiply by 125. Basically, any power of 5.

Knowing this, you just do:

668/5 = 133.6 = 133
668/25 = 26.72 = 26
668/125 = 5.344 = 5
668/625 = 1.0688 = 1

(You truncate the decimal because it does not constitute an additional zero.)

Summing the numbers, you get 165, but because you have three numbers (and because no extra zeros are added because of the 669 instead of 668), you multiply by 3, obtaining an answer of:

495.

(Afracsass, you were only off by five!)

So in fact, you could solve this without a calculator and without programming!

I think the next problem I give will be a little shorter.
Aredon
"I started out with 668+668+669 = 2006. " OMG, I can't add...
Related topics