|
||
Title: 21 FACTORIAL Post by jonderry on Aug 18th, 2004, 2:04pm I can't think of an elegant way to do this. We know that x + y = 2 (mod 9) which gives the possible combinations (0,2), (1,1), (2,0), (2,9), (3,8 ), (4,7), (5,6), (6,5), (7,4), (8,3), and (9,2). That's all I can get without serious number crunching. Does anyone know how to do this, and if so, can you give me a hint? Strange that this is in "easy" and 100 factorial is in "hard" unless I am missing something obvious. |
||
Title: Re: 21 FACTORIAL Post by Grimbal on Aug 18th, 2004, 2:19pm It is also a multiple of eleven. |
||
Title: Re: 21 FACTORIAL Post by jonderry on Aug 18th, 2004, 5:37pm I don't know of any interesting properties of multiples of 11. What property of multiples of 11 is useful for quickly solving this problem? |
||
Title: Re: 21 FACTORIAL Post by Icarus on Aug 18th, 2004, 8:12pm If n is even, then 11 divides 10n - 1. If n is odd, 11 divides 10n+1. From these two facts, you can prove that for any number, the difference between the sum of its digits in even position and the sum of its digits in odd position is congruent to the number itself modulo 11: If x = [sum]i xi10i, then x [equiv] [sum]i x2i - [sum]i x2i+1 mod 11. Thus, for example, 12345678 [equiv] ( 2+4+6+8 ) - ( 1+3+5+7 ) [equiv] 4 mod 11. |
||
Title: Re: 21 FACTORIAL Post by jonderry on Aug 19th, 2004, 10:56am I see. And that property can also be proved by noting that adding a 1 to an even (odd) digit always increases the tally mod 11 of the even (odd) columns by 1 relative to the odds (evens) (even when there is a possibly cascading carry). Thus, adding 11 always keeps the tallies equal modulo 11. So the answer is: [hide]x=4,y=7[/hide] right? |
||
Title: Re: 21 FACTORIAL Post by soundar on Sep 18th, 2004, 2:21pm this is an elementary question. we know 21! has 9 and 11 as factors; hence the sum of the digits must be divisible by 9 and the difference of sums of odd-place digits and even-place digits must be divisible by 11. hence we have x+y=2 mod 9; or, x+y=2 or 11 also, (41+y)-(11+x)=0 mod 11; or y-x=-8 mod 11; or, y-x=-8 or 3 so we have four sets of equations, 1) x+y=2, y-x=-8 2) x+y=2, y-x=3 3) x+y=11, y-x=-8 4) x+y=11, y-x=3 the first set results in 2y=-6, which is not possible; the second set results in 2y=5 and the third in 2y=3, both not possible hence the last set must give us the solution, 2y=14, or y=7 and hence x=4 |
||
Title: Re: 21 FACTORIAL Post by Icarus on Sep 19th, 2004, 8:40pm It is elementary only if you are familiar with the rules for determining divisability by 9 & 11. Jonderry had never come across the "divisable by 11" rule. |
||
Title: Re: 21 FACTORIAL Post by murdok03 on Oct 1st, 2012, 7:25am I spent so much time on this that I feel I have to post my solution. Even though it's not the most elegant. 1. the number has to be dividable by 9 2. the number has to be dividable by 7 3. x & y single digits( 0...9 ) 1. the sum of all digits has to be dividable by 9: => x+y=2 or x+y=11 2. the number has to be dividable by 7: see: h t t p : // math.about.com/library/bldivide.htm ( I had to google this one ) it's complicated but: 3x+4y={5,12,19,26,33,40,47,54} if we solve for x+y=2 none have solutions if we solve for x+y=11 y+33={5,12,19,26,33,40,47,54} where y={0..9} => y+33=40 => y=7 and x=11-7=4 And than I found this forum, hmm too bad I didn't think of divide by 11 it would of been alot simpler |
||
Title: Re: 21 FACTORIAL Post by JudyNeary on Oct 8th, 2012, 10:37pm Hi ! you simply this coding using c. i hope you get the result perfectly. #include <stdio.h> int main() { int c, n=21, fact = 1; printf("Enter a number to calculate it's factorial\n"); scanf("%d", &n); for (c = 1; c <= n; c++) fact = fact * c; printf("Factorial of %d = %d\n", n, fact); return 0; } |
||
Title: Re: 21 FACTORIAL Post by towr on Oct 9th, 2012, 8:52am The problem is NOT to calculate 21 factorial, but to solve the puzzle without doing exactly that: Quote:
|
||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |