1 | initial version |
I agree with Jason on most of these. The only one of these which is worthy is the (n-1)! one. I feel like it's ok for me to give Sage commands to do this, though not in one fell swoop - s/he'll still have to put it together.
Keep in mind, though, Mathstudent2010, that your instructor is almost certainly NOT looking for this! Instead a more theoretical result is probably in mind. In particular, although your instructor might find it okay to find a pattern using a computer program, they almost certainly will not appreciate a 'proof' of it using the program. You'll have to discover that part for yourself.
In general, if you want to just see the output of something for a certain number of integers, I recommend
for n in [1..100]:
print do_this_thing(n)
This isn't the best longterm, but it provides immediate feedback. This is called a loop.
Secondly, the factorial function is easy - for instance, 10! is factorial(10)
.
Finally, you can get modular arithmetic as well. For instance, 25 modulo 7 is mod(25,7)
. Put it all together and you should be able to get an answer, possibly showing you a pattern - but not a proof.