Puzzler : Binomial Coefficients 
Author Message
 Puzzler : Binomial Coefficients

Although the following may not be as practical as the solutions offered by
Weigang and Hui, it may be of some pedagogical interest:

   ]e=:_ q: !12         NB. exponents of primes
10 5 2 1 1
   p=:2 3 5 7 11
   p^e
1024 243 25 7 11
   */p^e
4.79002e8
   9 ": */p^e
479001600
   9 ": !12
479001600

   ]tf=:12 11 10 9 8,:1 2 3 4 5 NB.Tables for 5!12
12 11 10 9 8            
 1  2  3 4 5
   ]tex=:_ q:tf                 NB. Tables of exponents
2 1 0 0 0
0 0 0 0 1
1 0 1 0 0
0 2 0 0 0
3 0 0 0 0

0 0 0 0 0
1 0 0 0 0
0 1 0 0 0
2 0 0 0 0
0 0 1 0 0
   +/"2 tex                     NB. Sums of each table
6 3 1 0 1
3 1 1 0 0
   ]ex=:-/+/"2 tex
3 2 0 0 1
   */p^ex
792

   +/-/tex                      NB. An alternative expression
3 2 0 0 1

Knuth's expression for the prime decomposition of the factorial alluded to
by Weigang might make a further simple problem for re-expression in APL. A
companion volume to Knuth expressed in an executable language would be a
much more difficult undertaking, but a very useful contribution.



Mon, 31 Aug 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Puzzler: Binomial Coefficients

2. puzzler: binomial coefficients

3. Puzzler: Binomial Coefficients

4. Puzzler: Binomial Coefficients

5. Binomial Coefficients

6. Binomial coefficients

7. binomial coefficient (by hand)

8. binomial tree

9. LogoFE and binomial distribution

10. ? generating random uniform and binomial random deviates for BIG integers

11. Help to create a binomial distribution

12. Negative Binomial Approximations

 

 
Powered by phpBB® Forum Software