Skip to content

Instantly share code, notes, and snippets.

@morgaine
Created September 14, 2019 15:14
Show Gist options
  • Save morgaine/9c1726fbf9e8a3b878aa3920e9d3bf1c to your computer and use it in GitHub Desktop.
Save morgaine/9c1726fbf9e8a3b878aa3920e9d3bf1c to your computer and use it in GitHub Desktop.
Hyper-Exponential function in Nickle
#! /bin/env nickle
#
# NAME
# hyper_exponential.nickle
#
# DESCRIPTION
# Calculates the sequence:
# 1
# 2^2
# (3^3)^3
# ((4^4)^4)^4
# (((5^5)^5)^5)^5
# ((((6^6)^6)^6)^6)^6
# ...
# for terms 1..100
#
# AUTHOR
# Morgaine Dinovan
# - Donated to the Public Domain.
# - Copyright and author's rights waived
#
# COPYRIGHT
# Public Domain @ 2010-
#
# SEE ALSO
# http://nickle.org/ -- Great arbitrary precision programming language
# http://www.research.att.com/~njas/sequences/A053015 -- Sequence citation
# CodeWarrior Carling -- Expert sequence naming services, ask for a quote
# Imaze Rhiano - Googling expertise unrivalled, we are not worthy
#
# WARNING
# This program barely gets started by the time of heat death of the
# universe. Don't forget to save your work.
#
int max_term = 100;
for (term=1; term <= max_term; term++)
{
int base = term;
for (n = 1; n < term; n++)
{
base **= term;
}
printf("Calculating term %d of sequence:\n", term);
printf("%d\t%d\n", term, base);
}
@morgaine
Copy link
Author

morgaine commented Sep 14, 2019

Output for N in [1..6]:

|===================
|       N       f(N)
|===================`
|       1       1
|       2       4
|       3       19683
|       4       340282366920938463463374607431768211456
|       5       71821208748307350806616247734800247443646340206560432071396707807743664171107442303767251899701806274179648528361693395908493607789072590515205376005217038518864343357974324172025963219925969594574290850486833464941042717610929437440253086127413158881119110878565254870714807127305501250316534243564700489124592870454956410729577301690317708800960633255792684347901301624401393481617554653310899100138176009977541980333626270294189453125
|       6       801905114177186421268233247183671872285611243790287670326429840266965276859090994232722804099071308208566642345342525473839197857922206826881247686613054597643639074114299814658910570299338387275018144418060451356204425587436618355894265899469206493496576567060902508216857234809659411883436856907262181406555792173257484458552977375606894392453200909034506894234184478236418421979962663479216120643800922939369420248674473362609602187661563551041157505739642033306712744000213561038789775549335115383195493100990320977797431849066454349854112351669394350351724119648421429675482501486302736500144621886523347992629826999974724330860189653089828532182794794248240477416274638167362282413526807854514320952096682617889397115584667137201322422937457729214489407907405518444344340089061930346769872400573045001311080100230425970533942745847972064970363330555794582550644070075448682407064391762605241178885977478172470439245614352782718873090563810918058676016196022517960964002392982148152622058158104958518830487349863461522737045419079805176828913337987237167998461268815906214056666240308532663321889986375962262141989078341225419274892934633471601337630145021177561682163361588301146273292029772181095793682371661321565671179250200873481397054591452273317157196303425228704984654767851075710532634534940796785677558890950799401875263511992661902169258890278086716291023843497372147231848593552275703330179333395157137953888601584226588131426100524625525615311244683340215525755193173697123985498932994880224661923242660863038692352636818818091446575100518750311622740988660944192795623802082203241025300988864720691114284336174884722725160551906710564699824148484730470707902578930619626494023221095499047958286617225276486876179287677463797214957475199592111410409161111024724320181524607190511675442364059199832339531178389332438871670894278123643702026198922090184989766828514386825218944751917133528352820304932965893847129193929732262192111912880919222840357641983028044015106742642713134002917504796175868158080020653346101062376128143166925008124162624778493310053821947745097837762493928482536937358487491224793636348213860230948090092608071270697036421316013417589210684049327427491895567716870540159334726003182535675968082210912512117117036411988561552555424135025992192431252311247070107037564320408519913415791972361428643569407291782230769633403762980911951260235335468415654697223881790965348650156255150470465709634202169556242801373930782315697735699489821418879261442079714412155375949060050935369523298480393127780154774697206538820578852481294171389639340821243198793285107034663451816584313178509573270340714717653972268811979935455568659825920079977104240044757023571324964943766412817014787831726000431239296277568149403379174685366513529096824121631549336050517240784764044158530092410468898790882906726991168235676755052595083949405892993514487989629327303507999701858400364951812663411243218524311814960565403396906101566037518454582866326674740652656967374738643546913572072027015270654024870872914125274032777679768834616330289620042855458464404935752253141307743949799679373788177021131263060724194551523232678825949835712984835004658258078967038721817894573819554326478723879110512134676175579870238496958283594595247111635504199858696576767040558179086446871276735764539552108394244368401906598270272523213985019325867597404117299522896174182781347656228133260501669599573840643828131130837868317552037425215982186057658406291543623646877113038178380490129752610988187060310837787799219303381539699528293723206372177059719935531506073859021197524406579643039883039728628836461474751067864431977032358675848360773708387211420116787599737621317224241346875009176863639530452676627730931378159457365569487241901935734071637648678771531953675914311001534496147038332750307708867979198279698026903039770263012642154401276299002427289117685602673262358039948743624480371236137632544504304823818957992107773203870105130812284336956828027729321903579499814164578180299915045407689667530374597860119037107839602699845102433609954824008871263055281424268092422912559273889700924995226448267306343535545322900135542162984089368300143981387952516535890373585769044768270079232745085310534780379433679641764412570375902770137404074177820073270088260988742823688892707845709507869126201853287365775198969687579436875786108977542040269149258582213880806730504418248217557255761673402533058045211820437282641288015597565632574887136806808091337017274509640585947630061378243713693613162003445998800513844020356593674967439236032719297765887804559453426094291753338337320872533167029618779345490908355556740326053560776376448793273729369475913183616635968036303958961312252848799884953039291437629677310491001983631561495387558374254249597009726836978531354929462178177642763033790164067445673502415866746505721852575827258860644876762985518399443861444129789611155823260748613960983738802730799807870324833863673572794179621716686213597175126065963043765314408250036111188043650982973774434447477841745166609106376305766597815630308332278922332012868449774553692733717992022275716188668002733820424048869010692647287753683032329124547512690629495028349649028761229072342231520826626527689967862367744521152658974319063649327835030970627742864238920810668385925185216817124523427167003892110153204070727224612710173873389921936290442205620640819677053163599111244195701659784290628033387794423384897379043640715550904349542341988051448696644729119321923974170788984946987136512729765351867471308995876186529082842949528120694579172451660355612447630749890773691802401321948599241617171873740187460875541452669196018430458379320978910452677708740121149389289049260368909671797571587872574361576403325458450829959641703568470576948819313050657979060435743564740553565911085870118497098825973672356583186516354715506718750007325734787689281138147193205163931032061943134231140199543095420684425751639787908398865190601747112700042196582032481766506799648617686643106868998527331337192639617847034473260672095881810378587492712587519328256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment