(42S) Subfactorial
|
09-11-2021, 04:15 PM
(This post was last modified: 11-19-2024 07:07 PM by C.Ret.)
Post: #10
|
|||
|
|||
RE: (42S) Subfactorial on HP-15C
(09-06-2021 06:50 PM)John Keith Wrote: [...]The second formula can also be simplified to round(n!/e). More information and formulas at A000166. The round trick give me the idea for a short and fast code for my HP-15C : Quote:In[2]:= subfac[30] 30 f D compute !30 and f PREFIX display 97.58107385 E 30 these makes 9/10 digits are alright, fast and not bad for a truthfully Voyager oldie ! 5 f D display exactly 44, let verify the statistics : 12345 - 21345 - 31245 - 41235 - 51234 * 12354 - 21354 - 31254 * 41253 * 51243 - 12435 - 21435 - 31425 - 41325 - 51324 - 12453 - 21453 * 31452 * 41352 - 51342 - 12534 - 21534 * 31524 * 41523 * 51423 * 12543 - 21543 - 31542 - 41532 * 51432 * 13245 - 23145 - 32145 - 42135 - 52134 - 13254 - 23154 * 32154 - 42153 - 52143 - 13425 - 23415 - 32415 - 42315 - 52314 - 13452 - 23451 * 32451 - 42351 - 52341 - 13524 - 23514 * 32514 - 42513 - 52413 - 13542 - 23541 - 32541 - 42531 - 52431 - 14235 - 24135 - 34125 - 43125 - 53124 * 14253 - 24153 * 34152 * 43152 * 53142 - 14325 - 24315 - 34215 - 43215 - 53214 * 14352 - 24351 - 34251 * 43251 * 53241 - 14523 - 24513 * 34512 * 43512 * 53412 * 14532 - 24531 * 34521 * 43521 * 53421 * 15234 - 25134 * 35124 * 45123 * 54123 * 15243 - 25143 - 35142 - 45132 * 54132 * 15324 - 25314 - 35214 * 45213 * 54213 * 15342 - 25341 - 35241 - 45231 * 54231 * 15423 - 25413 * 35412 * 45312 - 54312 - 15432 - 25431 * 35421 * 45321 - 54321 - Total : 5! = 120 arrangements (- & *) !5 = 44 derangements ( * ) How the asterisk are randomly distributed makes me believe of un vrai dérangement. Couldn't Albert Chan please verify that with 30 elements, he exactly gets 97581073836835777732377428235481 asterisks (*) ? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)