Jump to content

Catalan numbers: Difference between revisions

Line 2,501:
 
=={{header|langur}}==
This would also work with langur prior to 0.8 with smaller numbers. 0.8 uses arbitrary precision.
 
{{trans|Perl}}
{{works with|langur|0.8}}
<lang langur>val .factorial = f if(.x < 2: 1; .x x self(.x - 1))
val .catalan = f(.n) .factorial(2 x .n) / .factorial(.n+1) / .factorial(.n)
 
for .i in 0..50015 {
if .i < 13 or .i > 490: writeln $"\.i:2;: \(.catalan(.i):10)"
}</lang>
 
Line 2,526 ⟶ 2,523:
11: 58786
12: 208012
13: 742900
491: 2114776097533740606385198422490043158878676176801525321807287162151127286246369896007134222669127440917660748038558772650245248030034846320300698926090740938829413534898946708540853820936476824352519837981827014277807194977419451474885213130379243211073014222954096423862462042918899142044000
14: 2674440
492: 8433366750002705947572616832891328296867094043796752094671656309917071490386132283062932823057818557493146106782569060913554072265818474372639298354349689017725409755803913243390098604383597234639054769720632677627117536157417122920130484816076251831581229132510656327208114353709037957928000
15: 9694845</pre>
493: 33631037444342774730198492228331815272931528879108505316808022126592370113483159104522221986688061858828942976440609412954861381302960312781577768741030136366232909350068237023235818321124871563236716389371753795395590174554882048892018330136984243134038504840174074827125476268839685783640000
494: 134116500838651792560427926583286875452054218196687251505816233692713815361647992065306800407519664867329966536351036325601810841802108398850170738373320180175643965771787272492661627001819184779453087177009781802244232332467347807096654916546276557467862643544451765068173111423615231791728000
495: 534843626328333156622029110447059354121296862082756821529242964201991787873668807066888812915471566749150552034077318250081415010251150026059753468754893783039160815114103276190493343164512797366447996847026912106530426519395995892010450453484949658611758687360737079243641964507884936459754000
496: 2132917640609167638681814279489077746214105393657996016641769728467500449830204377478015346475783994560998780948775140385636548390981447387626622485054727319886552787839341435431705847388459485674647745977479556931877877990830711987856564987539577914222345509756500786842853870532450591676524000
497: 8505972759537764920526271403745599204781552834949357608535250362924610227636116252352085297391379544574585499928247849007779488161624808256679663163290539070872879190058096567805959463681687828413354264078864257162067200180300791180488229046693979392862606791920503137891381098147483684878668000
498: 33921614812585475334363286760428341518066713710519482246463222890220389484961666016394087658935561710828507304323072584219401165213694125111808676743383111725525109395221667675218154975403925407900951874783446636778584625969536221341025202009861761506606387807458519527863423617862710486790680000
499: 135279399872590875633440787600588225974050054277551695198895332886198913266027124073379621583835020102784087129640413465866971846872212170945893002852611849561394136268144010688770002041910854526708996076636385187472995488366510450708008505615328704888346274576144575877119333388036489421321231840
500: 539497486917039060909410566119711128734834348196703167679426896420410037336371644508208550747509720888947317534973145917768881736628103627844100238921194561723883202123256952806711505149177419849031086149939116975191706558395784192643914160118616272189452807591091542120727401415762287153293056320
</pre>
 
=={{header|Liberty BASIC}}==
1,006

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.