The examples in this article describe how Python handles large numbers. Share to everyone for your reference. The implementation methods are as follows:
?
1 2 3 4 5 6 7 8 9 |
def getfactorial (n): "" "returns the factorial of n" "" If n = = 0:return 1 else:k = n * getfactorial (n-1) return k to K I N Range (1): print "factorial of", k, "=", Getfactorial (k) |
The results of the operation are as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68-69 |
Factorial of 1 = 1 factorial of 2 = 2 factorial of 3 = 6 factorial of 4 = factorial of 5 = factorial of 6 = 720 FA Ctorial of 7 = 5040 factorial of 8 = 40320 factorial of 9 = 362880 factorial of = 3628800 factorial of one = 39916800 FA Ctorial a = 479001600 factorial = 6227020800 factorial of = 87178291200 factorial of = 1307674368000 facto rial = 20922789888000 factorial = 355687428096000 factorial of = 6402373705728000 factorial of 19 = 1216451 00408832000 factorial = 2432902008176640000 factorial of = 51090942171709440000 factorial of 22 = 112400072777760 7680000 factorial = 25852016738884976640000 factorial a = 620448401733239439360000 factorial of 25 = 15511210043 330985984000000 factorial an = 403291461126605635584000000 factorial of a = 10888869450418352160768000000 factorial of factorial = 304888344611713860501504000000 = 8841761993739701954543616000000 factorial of 30 = 26525285981219105 8636308480000000 FactoriAl of = 8222838654177922817725562880000000 factorial of = 263130836933693530167218012160000000 factorial of 33 = 868 3317618811886495518194401280000000 factorial = 295232799039604140847618609643520000000 factorial of 35 = 10333147966386144929666651337523200000000 factorial of 371993326789901217467999448150835200000000 factorial of 37 = 13763753091226345046315979581580902400000000 factorial of 38 = 523022617466601111760007224100074291200000000 factorial = 20397882081197443358640281739902897356800000000 factorial of 40 = 815915283247897734345611269596115894272000000000 factorial of 41 = 33452526613163807108170062053440751665152000000000 factorial of 42 = 1405006117752879898543142606244511569936384000000000 factorial of 43 = 60415263063373835637355132068513997507264512000000000 factorial of 44 = 2658271574788448768043625811014615890319638528000000000 factorial of 45 = 119622220865480194561963161495657715064383733760000000000 factorial of 46 = 5502622159812088949850305428800254892961651752960000000000 factorial of 47 = 258623241511168180642964355153611979969197632389120000000000 factorial = 12413915592536072670862289047373375038521486354677760000000000 factorial of 49 = 608281864034267560872252163321295376887552831379210240000000000 factorial of 50 = 30414093201713378043612608166064768844377641568960512000000000000 factorial of 51 = 1551118753287382280224243016469303211063259720016986112000000000000 factorial of 52 = 80658175170943878571660636856403766975289505440883277824000000000000 factorial of 53 = 4274883284060025564298013753389399649690343788366813724672000000000000 factorial of 54 = 230843697339241380472092742683027581083278564571807941132288000000000000 factorial of 55 = 12696403353658275925965100847566516959580321051449436762275840000000000000 factorial of 56 = 710998587804863451854045647463724949736497978881168458687447040000000000000 factorial of 57 = 40526919504877216755680601905432322134980384796226602145184481280000000000000 FACTorial = 2350561331282878571829474910515074683828862318181142924420699914240000000000000 factorial of 59 = 13868311854568983573793901972038940634590287677268743254082129494016 0000000000000 factorial of 60 = 83209871127413901442763411832233643807541726063612459524492776964096 00000000000000 factorial of 61 = 507580213877224798800856812176625227226004528988036003099405939480985 600000000000000 factorial of 62 = 3146997326038793752565312235495076408801228079725823219216316824782 1107200000000000000 factorial of 63 = 1982608315404440064116146708361898137544773690227268628106279599612729753600000000000000 factorial of 64 = 126886932185884164103433389335161480802865516174545192198801894375214704230400000000000000 factorial of 65 = 8247650592082470666723170306785496252186258551345437492922123134388955774976000000000000000 factorial of 66 = 544344939077443064003729240247842752644293064388798874532860126869671081148416000000000000000 factorial of 67 = 36471110918188685288249859096605464427167635314049524593701628500267962436943872 000000000000000 factorial of 68 = 2480035542436830599600990418569171581047399201355367672371710738018221445712183296 000000000000000 Factorial of 69 = 171122452428141311372468338881272839092270544893520369393648040923257279754140647424 000000000000000 |
I hope this article will help you with your Python programming.