g | x | w | all
Bytes Lang Time Link
050C gcc/Linux250817T113144ZToby Spe
016dc250728T085742ZToby Spe
058AWK250728T204330Zxrs
016FIXAPL250728T155922Znoodle p
005Vyxal 3250728T085100ZThemooni
070C gcc230403T130836ZPeter
008cQuents250726T154858ZStephen
094Swift 6 Linux230715T021905ZmacOSist
004Thunno 2 S230714T143743ZThe Thon
070Python 3230403T140320ZGandhiGa
005vemf230331T231706Z
055Nibbles230225T202548ZAdam
010Stax230331T190528Zemirps
029Arturo230225T222412Zchunes
004Vyxal s230225T210551Znoodle p
nan230225T203143ZThe Thon
005Pyt230225T193920ZKip the
029Factor + math.factorials math.unicode210507T034247Zchunes
069Whispers v3210208T060026ZRazetime
041Golfscript200609T074834ZLCU00
00805AB1E200608T184408Znph
038Perl 6190422T042110Zbb94
007Husk190422T041341ZUnrelate
006Japt170706T082503ZShaggy
010Dyalog APL170706T082828ZUriel
011APL Dyalog170706T171614ZTwiN
038JavaScript ES7161220T010753ZNeil
054Racket161221T174629Zrnso
6466Ruby161220T024710ZDepresse
010Actually161221T124641ZTeal pel
079C#161221T094955ZAlfie Go
030R161220T134854Zbouncyba
042R161220T014837ZMickyT
049PHP161220T201631ZTitus
037Perl 6161219T234334Zsmls
041Ruby 2161220T185155ZLee W
097GameMaker Language161220T154956ZTimtech
013TIBasic161220T153914ZTimtech
019PARI/GP161220T144320ZCharles
072Python 2161220T122240ZNoodle9
056Haskell161219T222752Zflawr
033Wonder161220T021135ZMama Fun
012J161220T010822ZConor O&
082Python 2161220T003542ZAvahW
019Mathematica161220T000959ZGreg Mar
006Jelly161219T232505ZXanderha
007MATL161219T230547ZLuis Men
044JavaScript ES7161219T233953ZHuntro
00505AB1E161219T232109ZAdnan
008Pyth161219T231739ZMaltysen
037Cheddar161219T221601ZDowngoat
043Haskell161219T231404Znimi
011Pyke161219T223102ZBlue
012Brachylog161219T223105ZFatalize
019Mathematica161219T222718ZLegionMa

C (gcc/Linux), 64 50 bytes

This one overflows when n is 6 or more on systems with typical IEEE 64-bit double. Using 128-bit long double gets us one further (i.e. n=6 but not n=7).

double f(double n){n=lgamma(n+1);n=exp(n*exp(n));}

Results:

0!^{0!} = 1
1!^{1!} = 1
2!^{2!} = 4
3!^{3!} = 46656
4!^{4!} = 1.33373578e+33
5!^{5!} = 3.17504237e+249
6!^{6!} = inf

Try it online!


Extended range solution, 276 264 bytes

void f(long n){long double x=lgammal(n+1)/logl(10),y,a,b;x+=log10l(x);x==1./0?printf("inf"):isinf(a=powl(10,x))?x-=y=floorl(x),printf("10^%.*Lfe%+.Lf",x?6:0,powl(10,x),y):isinf(b=powl(10,a))?a-=y=floorl(a),printf("%.*Lfe%+.Lf",a?6:0,powl(10,a),y):printf("%Lg",b);}

This is not competitive with the code above; rather, it's intended to compete in a different subcategory - that of producing results for the most different inputs, in a practical time on a real computer. Here's the demo output:

0!^{0!} = 1
1!^{1!} = 1
2!^{2!} = 4
3!^{3!} = 46656
4!^{4!} = 1.33374e+33
5!^{5!} = 3.17504e+249
6!^{6!} = 1.90282e+2057
7!^{7!} = 1.777885e+18660
8!^{8!} = 3.868165e+185694
9!^{9!} = 6.447188e+2017526
10!^{10!} = 1.240804e+23804068
20!^{20!} = 1e+44731639502987747416
30!^{30!} = 1e+8600468560452408139844486642532352
40!^{40!} = 1e+39091843456657139784068190892939560752202293182464
50!^{50!} = 1e+1961194249104426500441405546006833473391980850423033331404255526912
69!^{69!} = 1e+16809924403224808293235140381454576341155398183556674955834345418995032420194094471055403328561217536
100!^{100!} = 1e+14742742594760650867234232737026362403922904392500636662106671589890301768723057903411416272284504707479426350022961168372558280324396598490958623545557558231040
1000!^{1000!} = 1e+1033171397749765315062914472693743118384114248246950950480996340554619164346055874761298242347163185909853157462102017000451320892791458888101807886896643758110758120210135789854028298392246044473373269816677859301009280041531283368156815007855270220098963703385228502995652146368000719052378243173933258346773038432594063717254804716732465412240064254705101061225786093809465551785021485252649999639705581660468395263799137072712474932026868650479064783758900580274035998820740872490124605562331468122752105776147573155894305809526664355573440962757793270688416920185855514488216136764081450296815965871492701392704153448282766552654089633484567815782825226015764183145078142214817853101058782523625462557350691461107947028157407305203395846964071004370565441056490502189024155434061648485336833199666859110882062232709836732836711596669651790404868969780336668488703845709622923575148282809010324028581919804627269471245192717896663146150231277845879325253550385063823675262539855048209446856384778811194323301077354793444861921664187672213265480014950017646204815384852615814644101597561921798734439334496504557348465535733468161608976564942920689538126106386622180244559850057046342304376991857995050003393648723014715627084472240219031016811735825612490113621740883605653490469760802416379726875329517593140350894570512151667526314051284990623922964714618087924159456397215368334580222967843999214964386576122759305356783884467175200571124912551823059229047765483101558909670504548993013246447614914511253229954514240668274814237686701529884917859946544451023397556447542186235912431121828274983291886302963317480928845064937899351830449457219464843980796964998752316405862807562783318330528831906898150361823447048061782492342707678891756949827289175919973368733363733914408747439038254419891899968593177409641694633947624189704410088472821918875574094537447829091564902516828833835761815814931662100571758071377660946321434350998666662608863195584869235042249934720129590303685215202276653368316185966107325216177198616287784513423369089343424207879160505416815094977334319150848757571683445990173476832167428781838959294522819126932137376397471035486583784020732561956087273926831683736665714364029256869565999291000004164513759990882066632578978694611895911898026878560620228574154899741122950129355862450340574842319623532705895262690355223913905699171145358503011192462514974787177004345452374555067526646381053822546337682569017651648873334166083642970791897305855705529218663073562289555814051218802602794674297298789003168174994516942538453322555756422103040
1000000!^{1000000!} = 10^4.599464e+5565715
1000000000!^{1000000000!} = 10^8.484011e+8565705532
1000000000000!^{1000000000000!} = 10^1.623431e+11565705518116
1000000000000000!^{1000000000000000!} = 10^1.715438e+14565705518096772
1000000000000000000!^{1000000000000000000!} = 10^1e+17565705518096748200
9223372036854775806!^{9223372036854775806!} = 10^1e+170914574008338964272
9223372036854775807!^{9223372036854775807!} = inf

Precision ranges from exact for the integer results up to ten orders of magnitude for the largest representable result. For a number that ends in 170,914,574,008,338,964,272 zeros, ten or so of those zeros is neither here nor there!

That output is produced by the following test program:

#include <stdio.h>

void print_ultrafactorial(long n)
{
    printf("%ld!^{%ld!} = ", n, n);
    f(n);
    printf("\n");
}

int main(void)
{
    print_ultrafactorial(0);
    print_ultrafactorial(1);
    print_ultrafactorial(2);
    print_ultrafactorial(3);
    print_ultrafactorial(4);
    print_ultrafactorial(5);
    print_ultrafactorial(6);
    print_ultrafactorial(7);
    print_ultrafactorial(8);
    print_ultrafactorial(9);
    print_ultrafactorial(10);
    print_ultrafactorial(20);
    print_ultrafactorial(30);
    print_ultrafactorial(40);
    print_ultrafactorial(50);
    print_ultrafactorial(69);   /* first result >= googolplex */
    print_ultrafactorial(100);
    print_ultrafactorial(1'000);
    print_ultrafactorial(1'000'000);
    print_ultrafactorial(1'000'000'000);
    print_ultrafactorial(1'000'000'000'000);
    print_ultrafactorial(1'000'000'000'000'000ul);
    print_ultrafactorial(1'000'000'000'000'000'000ul);
    print_ultrafactorial(9'223'372'036'854'775'806ul);
    print_ultrafactorial(9'223'372'036'854'775'807ul);
}

Try it online!

Explanation

#include <math.h>
#include <stdio.h>

void print_ultrafactorial(long n)
{
    long double x = lgammal(n+1) / logl(10); /* x = log₁₀ n! */
    x += log10l(x);                          /* x = log₁₀ log₁₀ n!^n! */
    long double a = powl(10, x);
    long double b = powl(10, a);
    /* The work is done here, for small n - just return b */

    /* Choose best representation to print */
    if (x > 0 && isinf(x)) {    /* x = -inf when n<2 */
        /* exceeded system limits */
        printf("inf");
    } else if (isinf(a)) {
        /* biggest representable - as approximate power of 10 */
        long double y = floorl(x);
        printf("10^%.*Lfe%+.Lf", x-y?6:0, powl(10, x-y), y);
    } else if (isinf(b)) {
        /* intermediate size - convert mantissa and exponent separately */
        long double y = floorl(a);
        printf("%.*Lfe%+.Lf", a-y?6:0, powl(10, a-y), y);
    } else {
        /* small result - C stdio can convert for us */
        printf("%Lg", b);
    }
    printf("\n");
}

dc, 16 bytes

Input and output at top of stack, as usual for dc.

[d1-d1<z*]dszxd^

There's a slight cheat for input 0, since we then compute 0⁰ = 1 instead of 1¹ = 1. But the result is correct, and that's all that matters!

Try it online!

How it works

d1-d1<z* is standard body of factorial function; saved as z it recurses building stack of descending integers, then multiplies them all together.

Once we have defined and executed the factorial, we simply raise the result to its own power: d^.

It works quite nicely up to a(8), but the function rapidly grows in complexity. It failed completely for a(11), exceeding its 1GB memory limit after 30 hours.

n digits seconds
7 18 676 0
8 185 710 1
9 2 017 542 62
10 23 804 085 2689
11 303 413 812 DNF

AWK, 58 bytes

$1>=0{for(z=1;i++<$1;t=1){for(j=0;j++<i;)t*=j;z+=t^t}}$0=z

Attempt This Online!

$1>=0{                # ignore negatives
for(z=1;              # fix off by one
i++<$1;               # $1 is input
t=1){                 # don't multi by 0
for(j=0;j++<i;)t*=j;  # factorial
z+=t^t}}              # power
$0=z                  # default output

FIXAPL, 16 chars

+/*⍨1×⫽⊙◡1+⍳¨⍳1+

This is a language I'm making, I don't really frequent this site anymore but I figured I'd post something about it. It's meant to be like APL but with fixed-arity functions, a little like Jelly.

Explanation: (Created with the help of Luminespire. 💎)

+/*⍨1×⫽⊙◡1+⍳¨⍳1+­⁡​‎‎⁡⁠⁤⁢‏⁠‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁡‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁣‏⁠‎⁡⁠⁤‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏‏​⁡⁠⁡‌­
             ⍳1+  # ‎⁡range from zero to 1 + [the input]
         1+⍳¨     # ‎⁢1 + the ranges from zero to each
    1×⫽⊙◡         # ‎⁣the product of each range
  *⍨              # ‎⁤raised to the power of itself
+/                # ‎⁢⁡summed

Usage:

screenshot of REPL giving correct result for the input 3

Vyxal 3, 5 bytes

ʁ!:*∑

Vyxal It Online!

ʁ!:*∑­⁡​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁢‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁣‏⁠‎⁡⁠⁤‏‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁢⁡‏‏​⁡⁠⁡‌­
ʁ      # ‎⁡range 0 inclusive implicit input
 !     # ‎⁢vectorized factorial
  :*   # ‎⁣vectorized n^n
    ∑  # ‎⁤sum resulting array, implicit output
💎

Created with the help of Luminespire.

<script type="vyxal3">
ʁ!:*∑
</script>
<script>
    args=[["0"],["1"],["2"],["3"]]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>

C (gcc), 71 70 bytes

-1 byte thanks to @ceilingcat!

i,j,k;a(n){for(j=0;~n;--n,j+=pow(i,i))for(i=k=1;n/++k;)i*=k;return j;}

You can test it online here.
Try It Online.

88 87-byte solution without builtins:

i,j,k,e;a(n){for(j=0;~n;--n,j+=e){for(i=k=1;n/++k;)i*=k;for(e=k=i;--k;)e*=i;}return j;}

Try It Online!

cQuents, 8 bytes

$0;$!^$!

Try it online!

Explanation

$0         starting index is 0
  ;        mode series - output sum of terms up through and including the input index
           each term in the sequence is
   $!                                   index factorial
     ^                                                  raised to the power of
      $!                                                                       index factorial

Swift 6 (Linux), 129 106 94 bytes

import Glibc
let s={(0...$0).reduce(0){$0+{pow($0,$0)}(Double($1<1 ?1:(1...$1).reduce(1,*)))}}

Try it on SwiftFiddle! Fatal-errors on n < 0, inf for n >= 6.

Thunno 2 S, 4 bytes

ĖwD*

Try it online!

Explanation

ĖwD*  # Implicit input
Ė     # Push [0..input]
 w    # Factorial of each
  D*  # To the power of itself
      # Implicit output of sum

Python 3, 70 bytes

import math
x=lambda n,f=math.factorial:1if n==0else f(n)**f(n)+x(n-1)

Try it online!

vemf, 3 5 bytes

▲↕!┴^

Explanation

▲↕    ' range [0, α)
   ┴  ' run this function:
    ^ '   exponentation
      ' with this for both inputs:
  !   '   factorial of each element in range

e.g. 3▲↕!┴^+try it online

Nibbles, 5.5 bytes

+~+.,$^;`*,

Attempt This Online!

-0.5 byte thanks to Dominic van Essen

+~+.,$^;`*,
+~          Add 1
  +         to the sum
   .        for each n in
    ,       range from 1 to
     $      input
        `*  of the product of
          , range from 1 to
            n
      ^     to the power of
       ;    itself

Stax, 10 bytes

Ç╔Ñst(jÖ3l

Run and debug it

This is PackedStax, which unpacks to the following 11 bytes:

R{|Fc#}m|+^

Run and debug it

R{    }m    # map over range 1..input
  |F        # push n!
    c       # dup
     #      # exponentiate
        |+  # sum
          ^ # increment (deals with 0 case)

Arturo, 29 bytes

$=>[∑map..0&=>[^<=∏1..&]]

Try it

Vyxal s, 4 bytes

ʀ¡:e

Try it Online!

ʀ  range [0, input]
¡  factorial (vectorizes)
:  duplicate list
e  exponentiate
s  sum

Thunno +, \$ 7 \log_{256}(96) \approx \$ 5.76 bytes

RFDz.^S

Attempt This Online!

Explanation

RFDz.^S  # implicit input
         # + flag adds one
R        # range from 0
 F       # factorial of each
   z.    # for each number:
  D  ^   #  raise it to the power of itself
      S  # sum the resulting list
         # implicit output

Pyt, 5 bytes

ř!ṖƩ⁺

Try it online!

ř           implicit input; řangify
 !          factorial
  Ṗ         raise n to the nth Ṗower
   Ʃ        Ʃum
    ⁺       increment

Factor + math.factorials math.unicode, 29 bytes

[ [0,b] [ n! dup ^ ] map Σ ]

Try it online!

  [0,b]                      ! range from 0 to input inclusive
        [          ] map     ! map over each element in the range
          n!                 ! factorial
             dup ^           ! raised to itself
                         Σ   ! sum

Whispers v3, 77 69 bytes

> Input
> 0
>> L!
>> … 2 1 3
>> L*L
>> Each 5 4
>> ∑6
>> Output 7

Try it online!

Yet another 69 byte answer thanks to Leo.

Golfscript, 41 bytes

{.{,{1+}%{*}*}{;1}if}:f;~.,\+{.f\f?}%{+}*

Try it online!

05AB1E, 8 bytes

ƒN!N!m}O

Try it online!

Perl 6, 38 bytes

{[+] map {my \a=[*] 1..$_;a**a},0..$_}

Try it online!

Husk, 7 bytes

→ṁo´^Πḣ

Try it online!

→          One plus
 ṁ         the sum of
     Π     x!
    ^      to the power of
   ´       itself
 ṁo        for each x in
      ḣ    the range from 1 to
           the input.

It would be slightly more correct to use ṁo´^ΠΘḣ, actually adding 0 into the range, but since 0!^0!=1^1=1, this works too.

Japt, 8 6 bytes

òÊx_pZ

Test it


Explantion

Implicit input of integer U
3

ò

Create an array of integers from 0 to U, inclusive.
[0,1,2,3]

Ê

Get the factorial of each integer in the array.
[1,1,2,6]

_

Map over the array.

pZ

Raise each element (p) to the power of itself (Z).
[1,1,4,46656]

x

Reduce by addition and implicitly output the result.
46662

Dyalog APL, 10 bytes

(+/!*!)0,⍳

How?

range of input

0, preceded with 0

!*! apply x! ^ x!

+/ sum

APL (Dyalog), 11 bytes

+/(*⍨∘!0,⍳)

Try it online!


This function train is equivalent to {+/*⍨!0,⍳⍵}, which is a straight forward implementation

JavaScript (ES7), 38 bytes

f=(n,a=1,i=0)=>i>n?0:a**a+f(n,a*++i,i)

Racket 54 bytes

(for/sum((i(+ 1 n)))(let((t(factorial i)))(expt t t)))

Ungolfed:

#lang racket
(require math)

(define (f n)
  (for/sum ((i (+ 1 n)))
    (let ((t (factorial i)))
      (expt t t))))

Testing:

(f -1)
(f 0)
(f 1)
(f 2)
(f 3)

Output:

0
1
2
6
46662

Ruby, 64 66 bytes

->n{(o=(1..n).map{|i|a=(1..i).inject(:*);a**a}.inject(:+))?o+1:1}

Added two characters for the off-by-one bugfix (will look into shortening the inject calls later).

Actually 11 10 bytes

1+r`!;ⁿ`MΣ

How it works

Program takes implicit input, implicit print at EOF
1+          Add one to the input n+1
  r         Create a range (0,1,..,n)
   `   `    Create a function between the two `
    !       Factorialize the current stack item
     ;      Duplicate the current stack item
      ⁿ     Power a,b from the current stack item
         M  Map the function across the stack top item
          Σ Sum the stack together

C#, 79 bytes with console output

n=>{int i=1,j=1;for(;i<=n;i++)j*=i;System.Console.Write(System.Math.Pow(j,j));}

C#, 64 bytes as a return

n=>{int i=1,j=1;for(;i<=n;i++)j*=i;return System.Math.Pow(j,j);}

R - 34 30 bytes

x=factorial(0:scan());sum(x^x)

vectorizing is nice

edit: saved 4 bytes thanks to @MickyT

R, 42 35 bytes

Now that I've read the question properly, I've put the sum in.

This requires the gmp (multiple precision arithmetic) library to be available. This allows for large numbers to be handled. Otherwise anything over 5 returns INF.

This is implemented as a unnamed function to avoid the as.character that would be required to output to STDOUT through cat

function(x)sum((i=gmp::factorialZ(0:x))^i)

Example run

> f <- function(x)sum((i=gmp::factorialZ(0:x))^i)
> f(5)
Big Integer ('bigz') :
[1] 3175042373780336892901667920556557182493442088021222004926225128381629943118937129098831435345716937405655305190657814877412786176000000000000000000000000000000000000000000000000000000000000000000000000000000000000001333735776850284124449081472890438
> f(6)
Big Integer ('bigz') :
[1] 190281878633201797429473437859705759836595323046380462211756876146775419721154680216391116383660154937824558291984804764687140715927099993629348072943551413397410741069111169123658220861477766905534108349401724389611558474171816216027733366046875815097164882588181826712426524007417126023680300953790645455254723360874298622143752208989152655091222094594342956890526202094068774356589887610542642450567071133028553816930267473112879050178461179814798008667622200592591542432361632955904924276854403585221477449385731481108378608652069211835448555831555820393949831627809528917004144455150642180845929102272754394116905511650997561389917179995442329297103257850695109383021080317204810134810158543814178231002423431556657737982683316707709406053569620116083909440177269311235173671447595521339849978144493268530780365729831790064477684808893338190825461650933123545889305523546630119181308584140916288912561260392366609493077363059677222110731132927863243720195975705161197786520981159422881575250362836779593393897664990291828935858671453835924398316498051705698128484688847592380831018330553151156822298060174230201841578757499203145955456593022852288527824268115043999037373974753999860179933517198889966353093307592136928730661270863274130109304971274296438682725017433937245229524959283895094220677649257613358344409711070780405579776000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003175042373780336892901667920556557182493442088021222004926225128381629943118937129098831435345716937405655305190657814877412786176000000000000000000000000000000000000000000000000000000000000000000000000000000000000001333735776850284124449081472890438

f(9) will runs pretty well, but fills up a number of pages. A few hundred or so and 2,017,528 digits. f(10) kills the session on my machine.

PHP, 49 bytes

for($f=1;$i<=$argv[1];$f*=++$i)$s+=$f**$f;echo$s;

INF for n>5 on a 64 bit system.

for large numbers, 70 bytes

while($i<=$argv[1])$s=gmp_add($s,gmp_pow($f=gmp_fac($i++),$f));echo$s;

requires PHP to be compiled with --with-gmp

Perl 6, 41 38 37 bytes

{[+] ([**] [*](1..$_)xx 2 for 0..$_)}

{[+] ([**] ([*] 1..$_)xx 2 for 0..$_)}

{sum (($_**$_ with [*] 1..$_) for 0..$_)}

(Try it online.)

Explanation:

Thanks to b2gills for 1 byte.

Ruby 2, 41 bytes

->n{(1..n).reduce(s=1){|t,i|t+(s*=i)**s}}

GameMaker Language, 97 bytes

Main function (52 bytes)

for(a=0;a<=argument0;a++)b+=power(f(a),f(a))return b

Function f (45 bytes)

a=argument0 if!a return 1else return a*f(a--)

TI-Basic, 13 bytes

sum(seq(A!^A!,A,0,Ans

P.S. You can replace sum(seq( with Σ( if you have a newer operating system (no size change).

PARI/GP, 19 bytes

n->sum(k=0,n,k!^k!)

Python 2, 73 72 bytes

import math
lambda n,f=math.factorial:sum(f(i)**f(i)for i in range(n+1))

Haskell, 67 56 bytes

Note that this submission was made before the rules that banned builtins were removed.

p=product
a n=sum[p[x|x<-[p[1..i]],_<-[1..x]]|i<-[0..n]]

For example:

*Main> a 0
1
*Main> a 1
2
*Main> a 2
6
*Main> a 3
46662
*Main> a 4
1333735776850284124449081472890438
*Main> a 5
3175042373780336892901667920556557182493442088021222004926225128381629943118937129098831435345716937405655305190657814877412786176000000000000000000000000000000000000000000000000000000000000000000000000000000000000001333735776850284124449081472890438

Wonder, 33 bytes

@sum(->@^ f\prod rng1#0f)rng0+1#0

Usage:

(@sum(->@^ f\prod rng1#0f)rng0+1#0)3

Explanation

rng0+1#0

Create inclusive range from 0 to input.

->@^ f\prod rng1#0f

Map over the range with a function that 1) calculates the factorial of the item, 2) stores the result to f, and 3) calculates f^f.

sum

Sum.

J, 15 12 bytes

Saved 3 bytes thanks to miles!

1#.i.^~@!@,]

Explanation

1#.i.^~@!@,]  input: y
          ,]  append y to list...
   i.         [0, y)
        !@    factorial each member
     ^~@      raise each to itself
1#.           perform summation

Test cases

   f =: 1#.i.^~@!@,]
   (,. f"0) i.4
0     1
1     2
2     6
3 46662
   (,. f"0) i.6
0           1
1           2
2           6
3       46662
4  1.33374e33
5 3.17504e249

   echo"1] _90]\":f 6x
190281878633201797429473437859705759836595323046380462211756876146775419721154680216391116
383660154937824558291984804764687140715927099993629348072943551413397410741069111169123658
220861477766905534108349401724389611558474171816216027733366046875815097164882588181826712
426524007417126023680300953790645455254723360874298622143752208989152655091222094594342956
890526202094068774356589887610542642450567071133028553816930267473112879050178461179814798
008667622200592591542432361632955904924276854403585221477449385731481108378608652069211835
448555831555820393949831627809528917004144455150642180845929102272754394116905511650997561
389917179995442329297103257850695109383021080317204810134810158543814178231002423431556657
737982683316707709406053569620116083909440177269311235173671447595521339849978144493268530
780365729831790064477684808893338190825461650933123545889305523546630119181308584140916288
912561260392366609493077363059677222110731132927863243720195975705161197786520981159422881
575250362836779593393897664990291828935858671453835924398316498051705698128484688847592380
831018330553151156822298060174230201841578757499203145955456593022852288527824268115043999
037373974753999860179933517198889966353093307592136928730661270863274130109304971274296438
682725017433937245229524959283895094220677649257613358344409711070780405579776000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000003175042373780336892901667920556557182493442088021222004926225128381629943118937129
098831435345716937405655305190657814877412786176000000000000000000000000000000000000000000
000000000000000000000000000000000000000000001333735776850284124449081472890438

Python 2, 82 Bytes

x=input()
s=0
for z in range(x):
 t=1
 for i in range(z+1):t*=i+1
 s+=t**t
print s

Mathematica, 19 bytes

Sum[n!^n!,{n,0,#}]&

Apologies for the extremely clear code ;)

Jelly, 6 bytes

Try it online!

‘Ḷ!*`S // Main link: Argument n (integer)
‘      // Take n, increment by 1
 Ḷ     // Range from [0..n]
  !    // Calculates factorial for each [0..n]
   *`  // Raises each [0!..n!] to the power of itself
     S // Sum the resulting array

MATL, 7 bytes

Q:Ygt^s

Try it online!

Explanation

Q         % Take input n implicitly. Add 1
 :        % Range [1 2 ... n+1]
  Yg      % Gamma function, element-wise. This gives [0! 1! ... n!]
    t^    % Rise result to itself, element-wise
      s   % Sum all values. Implicitly display

JavaScript (ES7), 44 bytes

g=n=>n?(f=a=>a?a*f(a-1):1)(n)**f(n)+g(n-1):1

05AB1E, 5 bytes

Code:

Ý!DmO

Explanation:

Ý       # Take the range [0, ..., input]
 !      # Map factorial over each element
  Dm    # Exponentiate each element to itself
    O   # Take the sum

Uses the CP-1252 encoding. Try it online!

Pyth - 9 8 bytes

s^Rd.!Mh

Test Suite.

Cheddar, 44 37 bytes

n->(0|>n=>(i,a=(1|>i)/(*))->a**a)/(+)

Thank goats for reduce operator! I think it would've been good idea to add factorial

Try it online

Ungolfed

n -> ( 0|>n => (i, a=(1|>i) / (*)) -> a ** a) / (+)

Explanation

Note: A little outdated, will fix

n ->           // Input
( 0 |> n) =>   // Run below for each of [0, n]
    (              
      i,           // Input
      a =          // Let's keep n! in this variable `a`
         (1 |> i)  // Range from [1, n]
         / (*)     // Multiply all the items of that range
                   // `/` is reduce `(*)` is multiplication function
    ) ->
    a ** a         // A to the power of A
) / (+)        // Sum all results

Haskell, 43 bytes

b n|f<-product[1..n]=f^f
a n=sum$b<$>[0..n]

Usage example: a 3-> 46662.

b calculates a single ultrafactorial and a sums all ultrafactorials from 0 to n.

Pyke, 11 bytes

hFSBD]1*B)s

Try it here!

hF          -  for i in range (0, input+1)
  SB        -     product(range(1, i+1)
    D]1*    -    [^]*^
        B   -   product(^)
          s - sum(^)

Fun fact: Pyke doesn't have a factorial built-in because SB is only 2 bytes!

Brachylog, 12 bytes

y:{$!F:F^}a+

Try it online!

Explanation

y                 The list [0, ..., Input]
 :{      }a       Apply the predicate below to each element of that list
           +      The output is the sum of the results

   $!F              F is the factorial of the input
      :F^           Output = F^F

Mathematica, 19 bytes

Sum[a!^a!,{a,0,#}]&

Anonymous function. Takes a number as input, and returns a number as output.