Ask Your Question

johnsa5's profile - activity

2018-04-10 06:18:05 -0500 received badge  Student (source)
2017-05-09 07:01:17 -0500 received badge  Famous Question (source)
2016-02-08 10:09:50 -0500 received badge  Taxonomist
2014-02-15 03:52:17 -0500 received badge  Notable Question (source)
2013-01-31 01:33:32 -0500 received badge  Popular Question (source)
2012-03-08 00:33:29 -0500 answered a question A proper combinatorics tutorial?

I'm not sure if this is still terribly relevant for you any more but I have made a good start on a tutorial. http://sagenb.org/home/pub/4474/ I hope this is helpful.

2012-03-08 00:26:26 -0500 received badge  Scholar (source)
2012-03-08 00:26:26 -0500 marked best answer calculating n!/(n-k)! for k-permutations

Sure, what you are looking for is the falling factorial.

for n in (0..7) : [falling_factorial(n,k) for k in (0..n)]
[1]
[1, 1]
[1, 2, 2]
[1, 3, 6, 6]
[1, 4, 12, 24, 24]
[1, 5, 20, 60, 120, 120]
[1, 6, 30, 120, 360, 720, 720]
[1, 7, 42, 210, 840, 2520, 5040, 5040]
2012-03-03 10:22:16 -0500 answered a question calculating n!/(n-k)! for k-permutations

Thanks, I thought doing it this way might be really slow but after some testing it appears that even with large inputs it doesn't take long to calculate.

2012-03-03 10:15:23 -0500 received badge  Supporter (source)
2012-03-03 10:01:08 -0500 answered a question calculating n!/(n-k)! for k-permutations

I am not looking for the binomial coefficient, what the binomial(n,k) calculates is n!/(k!(n-k)!). What I am looking for is a the number of ways to get k-permutations out of n elements. Sorry if I was not clear.

2012-03-03 09:40:33 -0500 asked a question calculating n!/(n-k)! for k-permutations

I was wondering if there is a way to calculate n!/(n-k)! in sage without using the factorial(n) method for n and n-k and then dividing.