Ask Your Question

johnsa5's profile - activity

2018-04-10 13:18:05 +0200 received badge  Student (source)
2017-05-09 14:01:17 +0200 received badge  Famous Question (source)
2016-02-08 17:09:50 +0200 received badge  Taxonomist
2014-02-15 10:52:17 +0200 received badge  Notable Question (source)
2013-01-31 08:33:32 +0200 received badge  Popular Question (source)
2012-03-08 07:33:29 +0200 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 07:26:26 +0200 received badge  Scholar (source)
2012-03-08 07:26:26 +0200 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 17:22:16 +0200 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 17:15:23 +0200 received badge  Supporter (source)
2012-03-03 17:01:08 +0200 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 16:40:33 +0200 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.