g | x | w | all
Bytes Lang Time Link
044AArch64 machine code250607T063031Z鳴神裁四点一号
015Excel240712T000858Zz..
014AWK241029T201453Zxrs
004TIBasic241103T152545ZYouserna
034Clojure240906T104408ZNikoNyrh
018Perl 5 pa240905T180934ZXcali
010ARBLE240905T061833ZATaco
044F# .NET Core240905T060546Zdtanku
040gnuplot 5.0240815T193205ZGlory2Uk
013Excel240814T015320ZTaylor R
009Juby240712T193339Znoodle p
034excel240716T092135Zpneumann
100Forth gforth240715T093323Zdavid
013Octave240714T133034ZTom Carp
002Japt mx240712T205301ZShaggy
028JavaScript V8240713T224123ZAndrew B
030Retina240713T185622ZNeil
014Desmos240713T160252ZAiden Ch
005J240712T014603Znoodle p
032Java240712T023659ZUnmitiga
012Julia 1.0240712T205413ZAshlin H
023min240712T200619Zchunes
002Pyt240712T131558ZKip the
007Brachylog240712T115821ZFatalize
853C gcc240712T114054Zkevidryo
033PowerShell Core240712T100433ZJulian
003Pyth240712T091144ZMukundan
027Google Sheets240711T233415Zdoubleun
029Bash240712T082329ZThemooni
115Whitespace240712T080008ZKevin Cr
005Charcoal240712T001352ZNeil
012R240712T070250ZGlory2Uk
001Vyxal s240712T065713ZKevin Cr
00205AB1E240712T065301ZKevin Cr
024Cognate240712T050821Zchunes
008Wolfram Language Mathematica240712T045510ZGreg Mar
004APLDyalog Unicode240712T032151ZMukundan
004Uiua240711T220003Znoodle p
014Factor240712T015607Zchunes
041Red240712T014531Zchunes
026JavaScript Node.js240712T002141Zl4m2
019Arturo240711T231748Zchunes
137sed 4.2.2 rz240711T223447Zguest430
026Python 3.8 prerelease240711T202931Zsquarero
017Haskell240711T203506Zxnor
042Nibbles240711T202550ZDominic
007APL+WIN240711T200539ZGraham
003Jelly240711T193202ZFmbalbue

AArch64 machine code, 44 bytes

For simplicity I am supporting 8-bit unsigned integers only for input. Can output 64-bit value. No overflow checks.

0000000000000000 <f>:
   0:   aa1f03e0        mov     x0, xzr
   4:   38401509        ldrb    w9, [x8], #1
   8:   b5000049        cbnz    x9, 10 <f+0x10>
   c:   d65f03c0        ret
  10:   d280002a        mov     x10, #0x1                       // #1
  14:   aa0903eb        mov     x11, x9
  18:   9b0b7d4a        mul     x10, x10, x11
  1c:   d1000529        sub     x9, x9, #0x1
  20:   b5ffffc9        cbnz    x9, 18 <f+0x18>
  24:   8b0a0000        add     x0, x0, x10
  28:   17fffff7        b       4 <f+0x4>

Original source

/// fn (x8: [*:0]const u8) x0: u64
.globl f

f:
mov x0,xzr

1:
ldrb w9,[x8],1
cbnz x9,3f
ret

3:
mov x10,1 // power to be added
mov x11,x9

2:
mul x10,x10,x11
sub x9,x9,1
cbnz x9,2b

add x0,x0,x10
b 1b

How I tested on Termux

$ cat main.s
//! Usage: $0 BINARY
//! Outputs binary
.globl _start

_start:
ldr x8,[sp,16]
bl f
str x0,[sp,-8]!
mov x0,1
mov x1,sp
mov x2,8
mov x8,64
svc 0

mov x0,0
mov x8,93
svc 0
$ as -o f.o f.s && as -o main.o main.s && ld -o main f.o main.o
$ ./main $'' | od -An -tu8
                    0
$ ./main $'\4\6\7' | od -An -tu8
               870455
$ ./main $'\xff' | od -An -tu8
  6455757693289234175
$ bc <<< '(255^255)%(2^64)'
6455757693289234175

Excel, 15 bytes

Expects input in A1:A

=SUM(A:.A^A:.A)

AWK, -vRS="," 27 14 bytes

{x+=$0^$0}$0=x

This will print the running total for each number. TIO doesn't do it quite right, however.

Try it online!

{for(;i++<NF;)x+=$i^$i}$0=x

TI-Basic, 4 bytes

sum(Ans^Ans

Takes input in Ans.

Clojure, 34 bytes

#(apply +(for[i %](Math/pow i i)))

The input must be a list.

Perl 5 -pa, 18 bytes

map$\+=$_**$_,@F}{

Try it online!

ARBLE, 10 bytes

sum(l|x^x)

Try it online!

F# (.NET Core), 44 bytes

let s n=n|>Seq.map(fun n->pown n n)|>Seq.sum

Try it online!

Shorter than a Seq.mapFold. Explanation: As many other solutions, this takes a sequence as input, maps each entry to its self-exponent then sums over itself. In F#, the ** operator is limited to floats, so pown is required.

gnuplot 5.0, 40 bytes

f(a)=sum[j=1:words(a)](n=word(a,j),n**n)

Try it online!

There are neither arrays nor vectorized functions in gnuplot 5.0. Instead of an array a common workaround is to use a string with separators.

Funny enough, there is a sum function which is supposed to sum up a range, but it could also be used as an accumulator.

Excel, 13 Bytes

Takes input as a dynamic array from A1# and output to the calling cell.

=SUM(A1#^A1#)

For the input of ={4;6;7}, outputs 870455.

J-uby, 9 bytes

:sum+~:**

Attempt This Online!

Expansion of J-uby code to standard Ruby:

:sum + ~:**                        # with spaces
->(a) {:sum.(a, &~:**)}            # (F + G).(*args) == F.(*args, &G)
->(a) {:sum.(a, {|x| (~:**).(x)})} # definition of &
->(a) {:sum.(a, {|x| :**.(x, x)})} # (~F).(x) == F.(x,x)
->(a) {a.sum {|x| x ** x}}         # :F.(x, y) == x.F(y)

excel, 34 bytes

=LET(a,TEXTSPLIT(A1,","),SUM(a^a))

if there's an array of integers in cell A1 separated by commas (without any zeroes), this should work i think.

Forth (gforth),  103  100 bytes

-3 bytes thanks to ovs

: ^ 1 TUCK +DO OVER * LOOP * ; : s 0 SWAP DUP @ 0 DO DUP I 1+ CELLS + @ DUP ^ ROT + SWAP LOOP DROP ;

Try it online!

No exponentiation in Forth so I first define ^ word and then the s word to compute the sum.

The idea:

addrTab
0 addrTab
\ enter the loop
0 addrTab addrElt1
0 addrTab Elt1
0 addrTab Elt1 Elt1
0 addrTab Elt1^Elt1
addTab 0+Elt1^Elt1
0+Elt1^Elt1 addrTab
... 
0+Elt1^Elt1+...+EltN^EltN addrTab
\ exit the loop
0+Elt1^Elt1+...+EltN^EltN

Octave, 13 bytes

Simple anonymous function that raises an array to the power of itself on an element wise basis, then sums.

@(x)sum(x.^x)

Try it online!

Japt -mx, 2 bytes

pU

Try it

       :Implicit map of each U in the input array
pU     :Raise U to the power of U
       :Implicit output of sum of resulting array

JavaScript (V8), 28 bytes

x=>x.reduce((a,c)=>a+c**c,0)

Try it online!

Retina, 30 bytes

~["L$`^¶$.("|""L$`.+
*$($&$*)_

Try it online! Explanation:

L$`.+

Loop over each input integer.

*$($&$*)_

Write that integer followed by a *, repeated (implicitly) that many times, then finally followed by a _. For example, 3 becomes 3*3*3*_, which is how you would calculate 3*3*3 in Retina.

|""

Join the calculations together, implicitly summing them.

["L$`^¶$.("

Turn the calculation into a command that replaces the input with the result of the calculation converted to decimal. (Retina 1 is clever enough not to actually do the calculation in unary if it knows that it will be converting the result to decimal.)

~`

Evaluate the resulting calculation.

For example, for inputs of 4, 6 and 7, the resulting calculation looks like this:

L$`^
$.(4*4*4*4*_6*6*6*6*6*6*_7*7*7*7*7*7*7*_

(The K command doesn't perform calculations so L$`^ is the easiest way.)

Desmos, 14 bytes

f(l)=l^l.total

Try It On Desmos!

Try It On Desmos! - Prettified

J, 5 bytes

1#.^~

Attempt This Online!

^~, called with one argument, raises that argument to the power of itself. When that argument is an array the operation is applied to each cell.

1#. means "from base-1." As it turns out, interpreting a list of integers as the digits of a base-1 number is equivalent to summing them.

This is because #. in J doesn't care whether the digits it is given are greater than the base itself - it just treats them as any other digit, multiplying them by their place value, and summing the results. In this "base-1", the place value is always 1, so this is equivalent to just summing the array.

Thanks to Conor for showing me this trick, saving a byte over the more trivial +/@: I had earlier.

Java, 32 bytes

l->l.map(x->Math.pow(x,x)).sum()

Try it online!

Saved 17 bytes thanks to Kevin Cruijssen.

Julia 1.0, 12 bytes

~x=sum(x.^x)

Try it online!

This solution showcases how operations in Julia can be vectorized with a dot. I've redefined a single-character operator, but an anonymous function x->sum(x.^x) could also be used for the same score.

By the way, sum can accept a subfunction to be called on each element before summation. For example, if A is a vector, sum(sqrt.(x)) can be shortened to sum(sqrt,x). It's not helpful in this case, since there's no unary definition for ^, but this method has been useful for most of my solutions involving sum, often saving bytes over solutions involving count.

min, 23 bytes

((dup pow ceil)map sum)

enter image description here

Pyt, 2 bytes

ṖƩ

Try it online!

Ṗ              implicit input; raise each element to itself
 Ʃ             sum the array; implicit print

Brachylog, 7 bytes

{^↙?}ᵐ+

Try it online!

Rare use of . There is a less elegant version also for 7 bytes: gjz^₎ᵐ+

Explanation

{   }ᵐ     Map for each integer:
 ^           Raise to the power...
  ↙?         ...of itself
      +    Sum

C (gcc), 85 + 3 bytes (-lm)

main(c,v,j,t,i)char**v;{i=t=0;while(i<c)j=atoi(i++[v]),t+=pow(j,j);printf("%d",t-1);}

This is about the maximum I can optimize it without using Lambdas, which would probably make the code even longer without manual Assembly rewriting.

I wanted to use something different than printf(), but since itoa() for some reason isn't available, I couldn't swap it with puts() because it didn't support string formatting.

Try it online!

PowerShell Core, 33 bytes

-join($args|%{'+1'
"*$_"*$_})|iex

Try it online!

Builds the expression as a string, e.g.

+1*4*4*4*4+1*6*6*6*6*6*6+1*7*7*7*7*7*7*7

Then evaluate it

Pyth, 3 bytes

s^V

Attempt This Online!

s^V­⁡​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁢‏⁠‎⁡⁠⁣‏‏​⁡⁠⁡‌­
s    # ‎⁡sum of
 ^V  # ‎⁢vectorized power with itself using the (implicit) input-list twice
💎

Created with the help of Luminespire.

Google Sheets, 27 bytes

=sort(sum(if(A:A,A:A^A:A)))

Uses sort as an array enabler, and if() to weed out blanks. In Google Sheets, the numeric value of a blank is zero, and the self-exponents of a blank column would thus sum up to the number of rows in the column.

screenshot

Bash, 29 bytes

for i;{
let t+=i**i
}
echo $t

use as a function or bash script. takes the array as an arbitrary number of arguments, outputs to stdout.

Attempt This Online!

explanation:

for i;{ # in bash, if the 'in array' part is not provided to 'for elem in array', it implicitly loops over all arguments
let t+=i**i # bash variables are initialized to 0, the rest is simple enough
}
echo $t

Whitespace, 115 bytes

[S S S N
_Push_sum=0][N
S S N
_Create_Label_OUTER_LOOP][S N
S _Duplicate_sum][S N
S _Duplicate_sum][T N
T   T   _Read_STDIN_as_Integer][T   T   T   _Retrieve_input][S N
S _Duplicate_input][N
T   S T N
_If_0_Jump_to_Label_PRINT][S N
S _Duplicate_input][S N
S _Duplicate_input][N
S S S N
_Create_Label_INNER_LOOP][S S S T   N
_Push_1][T  S S T   _Subtract_top_two][S N
S _Duplicate][N
T   S S S N
_If_0_Jump_to_Label_RETURN][S N
T   _Swap_top_two][S T  S S T   S N
_Copy_0-based_2nd_input_to_top][T   S S N
_Multiply_top_two][S N
T   _Swap_top_two][N
S N
S N
_Jump_to_INNER_LOOP][N
S S S S N
_Create_Label_RETURN][S N
N
_Discard_top_0][S N
T   _Swap_top_two][S N
N
_Discard_top_input][T   S S S _Add_top_two][N
S N
N
_Jump_to_OUTER_LOOP][N
S S T   N
_Create_Label_PRINT][S N
N
_Discard_top_0][T   N
S T _Print_as_Integer]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Since Whitespace can only read input one character/integer at a time, the input must contain a trailing 0 so we'll know when we're done reading inputs.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Integer sum = 0
Start OUTER_LOOP:
  Integer input = Read STDIN as integer
  If (input == 0):
    Stop OUTER_LOOP, and jump to PRINT
  Integer product = input
  Integer count = input
  Start INNER_LOOP:
    count = count - 1
    If (count == 0):
      Stop INNER_LOOP, and jump to RETURN
    product = product * input
    Go to next iteration of INNER_LOOP
  RETURN:
    sum = sum + product
    Go to next iteration of OUTER_LOOP
PRINT:
  Print sum as integer to STDOUT
  (implicitly stop the program with an error: No exit defined)

Charcoal, 7 5 bytes

IΣXθθ

Try it online! Link is to verbose version of code.

   θ    Input array
  X     Vectorised raised to power
    θ   Input array
 Σ      Take the sum
I       Cast to string
        Implicitly print

Edit: Saved 2 bytes because I forgot that Power is one of the four (five on ATO) operators that auto-vectorises if both parameters are lists.

7 bytes to take input as a string:

IΣEAXιι

Try it online! Link is to verbose version of code. Explanation: Power auto-casts strings to integer, so I don't need to write Iι twice.

R, 12 bytes

\(x)sum(x^x)

Attempt This Online!

Vyxal s, 1 byte

e

Try it online.

Explanation:

e   # Vectorized power with itself using the (implicit) input-list twice
 s  # Sum the list
    # (after which the result is output implicitly)

05AB1E, 2 bytes

mO

Try it online.

Explanation:

m   # Take the power of each value in the (implicit) input-list with each value in
    # the (implicit) input-list at the same position
 O  # Sum those
    # (after which this sum is output implicitly as result)

Cognate, 24 bytes

(For X(+ ^ Twin)0 Let X)

Attempt This Online!

Wolfram Language (Mathematica), 8 bytes

Tr[#^#]&

Try it online! Unnamed function taking a list like {4, 6, 7} as input. The exponentiation operator ^ automatically distributes over arrays of the same length, and Tr of a one-dimensional list is its sum.

APL(Dyalog Unicode), 4 bytes SBCS

+.*⍨

Try it on APLgolf!

Uiua, 4 bytes

/+ⁿ.

Try it

/+    # Sum of
  ⁿ   # each to the power of
   .  # itself

Factor, 14 bytes

[ dup v^ sum ]

Try it online!

Red, 41 bytes

func[b][x: 0 foreach n b[x: n ** n + x]x]

Try it online!

JavaScript (Node.js), 26 bytes

x=>x.map(t=>n+=t**t,n=0)|n

Try it online!

Arturo, 19 bytes

$=>[∑map&'x->x^x]

Try it!

Explanation

$=>[]      ; a function where input is assigned to &
∑          ; sum of...
map&'x->   ; map over input and assign current elt to x
x^x        ; x to the x power

sed 4.2.2 -rz, 167 137 bytes

s!.*!sed -r 'h;G;:r;s/.\\n./\\n/;x;s/\\n.*//;t;:b;s/.*/\&\\n\&/m;:;t;x;s/^#//;x;tb;G;h;s/\\n(.)/\\1/g;T;s/\\n../\&/;tr'<<<'&'!e
s/\n..//g

Try it online!

This essentially calls a second instance of sed with a snipit of the script I used for this question to calculate the powers, and then concats everything together at the end.

Python 3.8 (pre-release),  29  26 bytes

-3 bytes thanks to Albert.Lang.

lambda l:sum(map(pow,l,l))

Try it online!

Explanation

lambda l:                    # Anonymous lambda
         sum(            )   # Sum of...
             map(pow,   )    # Exponentiation of...
                     l,l     # element ** element for each element

Haskell, 17 bytes

sum.map((^)<*>id)

Try it online!

The (^)<*>id is point-free for \x->x^x. A list-comprehension solution is the same length.

f l=sum[x^x|x<-l]

Try it online!

Nibbles, 4 nibbles (2 bytes)

+.$^

Attempt This Online!

+.$^     # full program
+x$^$$   # with implicit variables shown
+        # sum of
 .       # map over
  $      # each element of input
   ^     # x to the power of y:
    $    #   x is each element
    $    #   y is each element

APL+WIN, 7 bytes

Prompts for vector of numbers.

+/i*i←⎕

Try it online! Thanks to Dyalog Classic

Jelly, 3 bytes

*`S

Try it online!

Explanation:

*`S 
*   Raise to        
 `    its own [4,6,7] => [256, 46656, 823543]
  S Sum       [256, 46656, 823543] => 870455