Post Reply 
(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.

On Free42 or the DM42 you have over 30 digits of precision so your first program (either formula) will be exact for fairly large values of n.

The round trick give me the idea for a short and fast code for my HP-15C :
[Image: attachment.php?aid=9806]
   

Quote:In[2]:= subfac[30]
Out[2]= 97581073836835777732377428235481

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 (*) ? Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(42S) Subfactorial - Eddie W. Shore - 09-06-2021, 04:43 PM
RE: (42S) Subfactorial - John Keith - 09-06-2021, 06:50 PM
RE: (42S) Subfactorial - Albert Chan - 09-07-2021, 02:21 PM
RE: (42S) Subfactorial - Werner - 09-09-2021, 07:24 AM
RE: (42S) Subfactorial - Albert Chan - 09-09-2021, 03:33 PM
RE: (42S) Subfactorial - Albert Chan - 09-08-2021, 10:26 PM
RE: (42S) Subfactorial on HP-15C - C.Ret - 09-11-2021 04:15 PM
RE: (42S) Subfactorial - Werner - 09-09-2021, 07:45 AM
RE: (42S) Subfactorial - Werner - 09-09-2021, 12:31 PM
RE: (42S) Subfactorial - ijabbott - 09-11-2021, 08:24 AM
RE: (42S) Subfactorial - Gil - 09-12-2021, 12:05 AM
RE: (42S) Subfactorial - Albert Chan - 09-12-2021, 12:46 PM
RE: (42S) Subfactorial - Matt Agajanian - 11-19-2024, 02:17 AM
RE: (42S) Subfactorial - Thomas Klemm - 11-19-2024, 04:32 AM
RE: (42S) Subfactorial - Thomas Klemm - 11-19-2024, 06:24 AM
RE: (42S) Subfactorial - Matt Agajanian - 11-21-2024, 01:31 AM
RE: (42S) Subfactorial - Thomas Klemm - 11-21-2024, 02:29 AM



User(s) browsing this thread: 2 Guest(s)