text:
The Median of Practically Recreational Languages
According to TIO there are two types of programming languages:

Practical (seen in many corporate environments as a development standard).
Recreational (if seen in a corporate environment, you're probably fired).

Your Task
Mix together one language from each of these realms to achieve the simple goal of calculating the median of a list.  You will write a program (or function) in one language of each type.  The list will be composed entirely of integers, and will be fed as input to your first program.  The output of that program will then be fed as input to the second program.  For a valid answer, the output of the second language must always be the median of the list.  Both programs must be at least 1 byte in length, and both must have an output that differs from their input in at least one case (e.g., neither program may be a cat program).  If the list has an even number of elements, your program may output any value between the two elements of the list closest to the median (inclusive).  The list is guaranteed to contain at least one element, and consist entirely of integers.
Test Cases
[1,2,3,4,5] = 3

[1,2,3,4,5,6] = 3-4

[-1,4,3,-2,0] = 0

[0,1,2,7,8,9] -> 2-7

[1,2,3,7,8,9] -> 3-7

Scoring:
This is code-golf, lowest sum of the byte-count of the two programs wins.

It looks like answers are just going to have one language do the work (probably with a built-in), while the other does something that just avoids the must-change restriction.

That is a problem.  I'm hoping for some more inventive answers though.

It's also not totally clear to me what counts as changing the input, given our defaults. For example, does it count if a function take a list and output its string representation? (Or do you really intend to enforce "program" and not allow functions?)

It does, as the output is not the same as the input.

Python + Actually, 6 + 1 = 7 bytes
sorted

Try it online!
║

Try it online!
The twist is that the Actually built-in for median (║) doesn't sort the list, hence it is perfectly combined with Python's sorted() built-in.

Jelly + Python,  4 3  2 + 3 = 5 bytes
-1 thanks to Mr. Xcoder (;0 -> W - I considered this but incorrectly disregarded it as an option)
-1 thanks to Luis Mendo (drop the W and change from sum to int)
Part 1, Jelly function:
Æṁ

A function which, given a list of integers will return their median.
e.g. [-1,-9,-2,-8,0,-7] yields -4.5.
Try it online!
Part 2, Python function:
int

A function which given an integer or a floating point number returns an integer (dropping any fractional part).
e.g. -4.5 yields -4.
Try it online!

Would W work instead of ;0?

Nope because Jelly represents a single item list as just the element

...although come to think of it I suppose it depends what "The output of that program..." means here, hmm. Edit yes I think it can be just W.

Yeah ;0 was a replacement for W which I had decided would not be acceptable, but you are right - the function's output is a list and that's all that should matter.

I must admit you found a short nearly-no-op... +1

I think you can drop W from Jelly and use int in Python

@LuisMendo "both must have an output that differs from their input in at least one case" - The output from the Jelly function would be an integer. Maybe we can drop the W and say the Jelly code is a full program so it prints a string? I dunno though. Edit - oh I see, the output wont always be an integer!

Jelly + Bash, 5 4 + 3 = 7 bytes
ÆṁṾṚ

Try it online!
-1 byte thanks to Jonathan Allan
A monadic chain that takes a list and returns (is that the right terminology?) the stdin for the bash program.
rev

Try it online!
Explanation
ÆṁṾṚ
  Ṿ   String representation
Æṁ    of the median
   Ṛ  reversed

@JonathanAllan fixed... even if the challenge says it was OK :P

Yes that change is a result of my question under the OP.

I believe you can do ÆṁṾṚfor this.

@JonathanAllan Thanks. As totallyhuman said, Jelly is a game of atom hide and programmer seek.

MATL + R, 1 + 19 = 20 bytes
S

Try it online!
S reads in input as a matrix [a_1, a_2, ..., a_n] and then sorts it. Then the program terminates, printing the values as b_1 b_2 ... b_n, which is then read by R's scan() as a vector. The R program then computes the median and prints it out.
cat(median(scan()))

Try it online!

JavaScript (Node.js) + Pyth, 11 + 10 = 21 bytes
n=>n.sort()

Try it online!
.O@R/lQ2_B

Try it online!
How the Pyth code works

.O@R/lQ2_B ~ Full program.

        _B ~ Bifurcate with reverse; Yields [Input, Reverse(Input)]
    /lQ2   ~ The length of the input divided by two, and floored.
  @R       ~ For each in ^^, get the element at index ^.
.O         ~ Average (arithmetic mean).

Actually and Python, 1 + 3 = 4 bytes
Actually, 1 byte
║

Full program that computes the median, possibly with a decimal part. Try it online!
Python, 3 bytes
int

Defines a function that rounds towards zero. Try it online!


text:
Reduce a number by its largest digit
Task:
Given an integer number in decimal number system, reduce it to a single decimal digit as follows:

Convert the number to a list of decimal digits.
Find the largest digit, D
Remove D from the list. If there is more than one occurrence of D, choose the first from the left (at the most significant position), all others should remain intact.
Convert the resulting list to a decimal number and multiply it by D.
If the number is bigger than 9 (has more than 1 decimal digit), repeat the whole procedure, feeding the result into it. Stop when you get a single-digit result.
Display the result.

Example:
26364 ->
1. 2 6 3 6 4
2. The largest digit is 6, so D=6
3. There are two occurrences or 6: at positions 1 and 3 (0-based). We remove the left one,
    at position 1 and get the list 2 3 6 4
4. we convert the list 2 3 6 4 to 2364 and multiply it by D:
   2364 * 6 = 14184
5. 14184 is greater than 9 so we repeat the procedure, feeding 14184 into it.

We continue by repeating the procedure for 14184 and so on and we go through the following intermediate results, finally reaching 8:
11312
3336
1998
1782
1376
952
468
368
288
224
88
64
24
8

So the result for 26364  is 8.
Input: An integer / a string representing an integer
Output: A single digit, the result of the reduction applied to the number.
Test cases:
9 -> 9
27 -> 4
757 -> 5
1234 -> 8
26364 -> 8
432969 -> 0
1234584 -> 8
91273716 -> 6

This is code-golf, so the shortest answers in bytes in each language win.

Which is it If the number is bigger than 10 or has more than 1 decimal digit. The number 10 has more than 1 decimal digit, but it isn't bigger than ten.

@Adám By coding logics, should then 10 -> 10?

@Adám You are right, I should have written "bigger than 9". I'm going to edit the description. Thanks!

Has someone examined the histogram of this function for sufficiently large regions? It seems to have a lot of zeroes; I also got many 8s while composing the test cases.

Being divisible by 2 or 5 is preserved once it happens, so it's no wonder you easily get 0. That might also increase the chance of 8s.

Also, a random number divisible by 4 has 3/5 probability of the product of the last two digits being divisible by 8.

05AB1E, 6 bytes
Code:
[Dg#à*

Uses the 05AB1E encoding. Try it online!
Explanation
[Dg#     # While the length of the number is not 1
    à    # Extract the largest element from the current number
     *   # Multiply it with the leftover number

JavaScript (ES6), 49 bytes
f=n=>n>9?f(""+n.replace(m=Math.max(...n),"")*m):n

Takes input as a string representation of an integer, like f("26364").
Test Cases

f=n=>n>9?f(""+n.replace(m=Math.max(...n),"")*m):n

;["9", "27", "757", "1234", "26364", "432969", "1234584", "91273716"]
.forEach(num => console.log(num + " -> " + f(num)))
.as-console-wrapper{max-height:100%!important}

Jelly, 13 bytes
œṡṀẎḌ×ṀD
DÇḊ¿

Try it online!
-1 thanks to a trick I found in Jonathan Allan's answer.
Full program.

Pyth, 16 bytes
.WtH`*s.-ZKeSZsK

Takes input as a String. Try it here! (Alternative: .WtH`*s.-ZeSZseS)
Pyth, 18 bytes
.WgHT*s.-`ZKeS`ZsK

Takes input as an integer. Try it here!
How it works
16-byter

.WtH`*s.-ZKeSZsK ~ Full program.

.W               ~ Functional while. While A(value) is truthy, value = B(value).
                 ~ The final value is returned.
  tH             ~ A, condition: Is value[1:] truthy?  Is the length ≥ 2?
    `*s.-ZKeSZsK ~ B, setter.
       .-        ~ Bagwise subtraction, used for removing the highest digit, with...
         Z       ~ The current value Z, and...
          KeSZ   ~ The highest digit of Z (as a String). Also assigns to a variable K.
      s          ~ Casted to an integer.
     *           ~ Multiplied by...
              sK ~ The highest digit.
    `            ~ Convert to a String.

18-byter

.WgHT*s.-`ZKeS`ZsK ~ Full program.

.W                 ~ Functional while. While A(value) is truthy, value = B(value).
                   ~ The final value is returned.
  gHT              ~ A, condition: is value (H) ≥ 10?
     *s.-`ZKeS`ZsK ~ B, setter.
       .-          ~ Bagwise substraction (used for removing first occurrence).
         `Z        ~ The string representation of Z.
           KeS`Z   ~ And the highest (lexicographically) character of Z (highest digit).
                     It also assigns it to a variable called K.
      s            ~ Cast to integer.
     *             ~ Multiply by...
                sK ~ K casted to int.

Being that close to Jelly at such type of challenge is very good for Pyth IMO :-)

Husk, 14 13 12 bytes
Thanks Zgarb for saving 1 byte.
Ω≤9oṠS*od-▲d

Try it online!
Explanation:
Ω≤9            Repeat the following function until the result is ≤ 9
           d     Convert to a list of digits
         -▲      Remove the largest one
       od        Convert back to an integer
   oṠS*          Multiply by the maximum digit

12 bytes with some rearranging.

@Zgarb Thanks, I was looking for something like that.

R, 99 95 bytes
f=function(x)"if"(n<-nchar(x)-1,f(10^(n:1-1)%*%(d=x%/%10^(n:0)%%10)[-(M=which.max(d))]*d[M]),x)

Try it online!
A recursive function. Adding f(number) in the footer can be used to test for other values of number. Straightforward implementation, d is the list of digits, and 10^(n:2-2)%*%d[-M] computes the number with the largest digit removed.

Python 2, 72 bytes
f=lambda n:`n`*(n<=9)or f(int(`n`.replace(max(`n`),'',1))*int(max(`n`)))

Try it online!

...I was debugging a dumb mistake in this. Darn, I got ninja'd.

I'm getting an error on input 9

This seems to fail for the test case 432969. "ValueError: invalid literal for int() with base 10: ''"

@JamesWebster should be fixed now.

I believe you can remove the first set of backticks.

@recursive No, as then if n was 0 then n*(n<=9) would still evaluate to a falsy value, 0, making the recursion continue and causing an error, whereas  the string '0' is a truthy value and therefore the recursion is halted.

Those particular backticks were particularly bothering me.  You were right, of course, about why they're needed in this solution.  But I rearranged it to eliminate them and save a byte.  It uses if ... else.  https://tio.run/##NYzBDsIgEAXvfAW3sqYxYaEgTfRbigppE7qSilG/HsXE48y8vPwu842w1nhMfj1fPacxioWKmGjabyEnfwli9a/G0HddLwF2rf8dwBI5nVxI98CpPuclBS7HvH1HvF3lRxEA1TG0zA6WSVSaoVFGM63QGfczw0EzJ9EqK80H

Ruby, 59 bytes
f=->n{m=n.digits.max;n>9?f[n.to_s.sub(m.to_s,"").to_i*m]:n}

Try it online!
Recursive lambda function called like f[26364].

C# (.NET Core), 126 bytes
int F(int n){var x=(n+"").ToList();var m=x.Max();x.RemoveAt(x.IndexOf(m));return n>9?F(int.Parse(string.Concat(x))*(m-48)):n;}

Try it online!

Welcome to PPCG! You can remove a space.

@EriktheOutgolfer Thank you, missed that one.

@totallyhuman Thank you, down to 137 after some refactoring.

You can change if(n<10)return n;...return F(...); to a single return with ternary-if, like this: int F(int n){var x=(n+"").ToList();var m=x.Max(d=>d);x.RemoveAt(x.IndexOf(m));return n<10?n:F(int.Parse(string.Concat(x))*(m-48));} (131 bytes)

I think you need to include using System.Linq; (18 bytes) into the bytecount.

Jelly, 15 bytes
D×Ṁ$œṡṀ$FḌµ>9µ¿

Try it online! or see the test-suite.
How?
D×Ṁ$œṡṀ$FḌµ>9µ¿ - Link: number, n
              ¿ - while:
             µ  - ...condition (monadic):
            9   -    literal 9
           >    -    loop value greater than (9)?
          µ     - ...do (monadic):               e.g. 432969
D               -    convert to a decimal list        [4,3,2,9,6,9]
   $            -    last two links as a monad:
  Ṁ             -      maximum                         9
 ×              -      multiply (vectorises)          [36,27,18,81,54,81]
       $        -    last two links as a monad:
      Ṁ         -      maximum                         81
    œṡ          -      split at first occurrence      [[36,27,18],[54,81]]
        F       -    flatten                          [36,27,18,54,81]
         Ḍ      -    convert from base 10              389421  (i.e. 360000 + 27000 + 1800 + 540 + 81)

Haskell, 70 67 66 bytes
Saved 3 4 bytes thanks to nimi!
f x|x<10=x|(a,b:c)<-span=<<(>).maximum$show x=f$read[b]*read(a++c)

Try it online!

An explicit recursion is shorter than until. Try it online!.

one more byte to save: ...span=<<(>).maximum....

Ooh ... Nice :)

APL (Dyalog), 36 35 33 bytes
-1 due to updated OP specs. -2 thanks to ngn.
Anonymous tacit prefix function. Takes integer as argument.
{⍵>9:∇(⌈/×10⊥⊂⌷⍨¨⍳∘≢~⊢⍳⌈/)⍎¨⍕⍵⋄⍵}

Try it online!
{…}a function where ⍵ is the argument:
 ⍵>9: if the argument is greater than 9, then:
  ⍕⍵ format (stringify) the argument
  ⍎¨ execute (evaluate) each (this gets us the digits as numbers)
  (…) apply the following tacit function on those
   ⌈/ the largest digit
   × times
   10⊥ the base-10 decoding of (collects digits)
   ⊂ all the digits
   ⌷⍨¨ indexed by each of
   ⍳∘≢ the indices of the number of digits
   ≠ differs from
   ⊢⍳⌈/ the largest digit's index in the entire list of digits
  ∇ recurse (i.e. call self) on that
 ⋄ else
  ⍵ return the argument unmodified

Shouldn't >10 be >9?

@EriktheOutgolfer Probably, but OP is actually unclear (self-contradictory) about that.

That's true, but >9 would save a byte.

@EriktheOutgolfer Updated.

@Adám ∇ instead of ⍣= for -1 byte: {⍵>9:∇(⌈/ ... ⋄⍵}

@Adám another -1: use ⌷ instead of / for removing D - replace ⊢(/⍨)⍳∘≢≠⊢⍳⌈/ with ⊂⌷⍨¨⍳∘≢~⊢⍳⌈/

@ngn Thanks for both.

Java 8, 126 104 bytes
n->{for(;n>9;n=new Long((n+"").replaceFirst((n=(n+"").chars().max().getAsInt()-48)+"",""))*n);return n;}

-22 bytes thanks to @OlivierGrégoire.
Explanation:
Try it here.
n->{         // Method with long as both parameter and return-type
  for(;n>9;  //  Loop as long as the number contains more than 1 digit
    n=       //   Replace the current number with:
      new Long((n+"").replaceFirst((n=(n+"").chars().max().getAsInt()-48)+"",""))
             //    Remove the first largest digit from the number,
      *n     //    and multiply this new number with the removed digit
  );         //  End of loop
  return n;  //  Return the result
}            // End of method

111 bytes

104 bytes (same as above, but iterative instead of recursive, also: n>9 and revert conditions instead of n<10).

PowerShell, 123 bytes
[Collections.ArrayList]$a=[char[]]"$args"
while(9-lt-join$a){$a.remove(($b=($a|sort)[-1]));$a=[char[]]"$(+"$b"*-join$a)"}$a

Try it online!
Ooof. PowerShell arrays are immutable, so we need to use the lengthy [Collections.ArrayList] casting here so we can call .remove() later.
Takes input $args, converts it to a string, then a char-array, then an ArrayList. Stores that into $a. Then we while loop until we're at or below 9. Each iteration, we're calling .remove on the largest element of $a (done by sort and taking the last element [-1]), storing the largest element into $b at the same time. This happens to work because the ASCII values sort in the same fashion as the literal digits.
Next, we recompute $a, again as an char-array (and ArrayList implicitly), by casting our $b (which is currently a char) to a string, then an int with +, and multiplying that to $a -joined into a string (implicitly cast to int). This satisfies the "multiply by D" portion of the challenge.
Finally, once we're out of the loop, we put $a onto the pipeline and output is implicit.

Perl 6,  45  41 bytes
{($_,{$/=.comb.max;S/"$/"//*$/}...10>*).tail}

Test it
{($_,{S/"{.comb.max}"//*$/}...10>*).tail}

Test it
Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  (  # generate the sequence

      $_,                      # start the sequence with the input

      {                        # generate the rest of the values in the sequence

          S/                   # find and replace (not in-place)
            "{  .comb.max  }"  # find the max digit and match against it
          //                   # replace it with nothing
          *                    # multiply the result with
          $/                   # the digit that was removed
      }

      ...                      # keep generating values until

      10 > *                   # the value is less than 10

  ).tail                       # get the last value from the sequence
}

C# (.NET Core), 177 164 + 18 bytes
Saved 13 bytes thanks to @raznagul!
int f(int n){string s=n+"",m=s.Max(d=>d)+"";if(n<10)return n;var x=s.ToList();x.RemoveAt(s.IndexOf(m));int y=int.Parse(string.Join("",x))*int.Parse(m);return f(y);}

Try it online!

You can change s.Length<2 to n<10. Also, you can remove the ternary operator and just return f(y) at the end, as the case is handled by the if in the next step of the recursion.

Retina, 67 bytes
{1`(..+)?
1$&;$&
O`\G\d
.+((.);.*?)\2
$1
\d+
$*
1(?=.*;(1+))|.
$1
1

Try it online! Link includes the test cases fast enough not to hammer Dennis's server. Explanation:
{1`(..+)?
1$&;$&

For two digit numbers, this duplicates the number with a ; separator, prefixing a 1 to the duplicate. For one digit numbers, this prefixes 1; to the number.
O`\G\d

Sort the digits of the duplicate. (For one digit numbers, this has no effect.)
.+((.);.*?)\2
$1

Find the first occurrence of the largest digit, and delete it, and also the other digits in the duplicate, and the extra 1 that was added earlier. (For one digit numbers, the match fails so this does nothing.)
\d+
$*
1(?=.*;(1+))|.
$1
1

Multiply the number by the digit. For one digit numbers, this results in the original number, and the loop terminates. Otherwise, the program loops until a single digit is reached.

C 103 , 95 , 90 bytes
a,b;t,m;f(n){for(t=m=0,a=b=1e9;a/=10;)if((t=n/a%10)>m)m=t,b=a;n=n>9?f(m*=n/b/10*b+n%b):n;}

Try it online!

Java 8: 115 bytes

-10 bytes thanks to Jo King

Unfortunately you can't call a lambda function recursively, so an extra 11 bytes is needed for the method header. I am aware there is a shorter Java answer that loops instead, but I decided to come up with this on my own.
long f(long n){int m=(n+"").chars().max().getAsInt()-48;return n>9?f(new Long((n+"").replaceFirst(""+m,""))*m):n;};

Try it online

You can move the -48 from the map to the end of the m definition. Try it online! You also have some extra whitespace in your TIO link

Technically you can have recursive lambda expressions, however, they require that you pass the lambda as a parameter when it is called

@KrystosTheOverlord good to know, not sure I can use it here though due to the input rules (only 1 input which is the number).

@BenjaminUrquhart ah my bad, well in the future it could be handy, as it makes recursive java solutions much smaller :)

D, 188 186 185 bytes
import std.conv,std.algorithm;T f(T,U=string)(T u){if(u<10)return u;T[]r;u.text.each!(n=>r~=n.to!T-48);T m=r.maxElement;U s;r.remove(r.maxIndex).each!(n=>s~=n.to!U);return f(m*s.to!T);}

Try it online!
I hate lazy evaluation, so much. Any tips are welcome!

Lua, 154 Bytes
I should have some ways to golf this down, I'm experimenting right now.
n=...z=table
while n+0>9 do
t={}T={}n=n..''n:gsub(".",function(c)t[#t+1]=c T[#T+1]=c
end)z.sort(t)x=t[#t]z.remove(T,n:find(x))n=z.concat(T)*x
end
print(n)

Try it online!
Explanations
n=...                    -- define n as a shorthand for the argument
z=table                  -- define z as a pointer to the object table
while n+0>9              -- iterate as long as n is greater than 9
do                       -- n+0 ensure that we're using a number to do the comparison
  t={}                   -- intialise two tables, one is used to find the greatest digit
  T={}                   -- the other one is used to remove it from the string
  n=n..''                -- ensure that n is a string (mandatory after the first loop)
  n:gsub(".",function(c) -- apply an anonymous function to each character in n
               t[#t+1]=c -- fill our tables with the digits
               T[#T+1]=c
             end)
  z.sort(t)              -- sort t to put the greatest digit in the last index
  x=t[#t]                -- intialise x to the value of the greatest digit
  z.remove(T,n:find(x))  -- remove the first occurence of x from the table T
                         -- based on its position in the input string
  n=z.concat(T)*x        -- assign the new value to n
end                      -- if it still isn't a single digit, we're looping over again
print(n)                 -- output the answer

Jq 1.5, 86 bytes
until(.<10;"\(.)"|(./""|max)as$v|index($v)as$x|.[:$x]+.[1+$x:]|tonumber*($v|tonumber))

Expanded
until(
    .<10                    # until number is below 10
  ; "\(.)"                  # convert to string
  | (./""|max) as $v        # find largest digit, call it $v
  | index($v) as $x         # find index of digit
  | .[:$x]+.[1+$x:]         # remove digit
  | tonumber*($v|tonumber)  # convert back to number and multiply by $v
)

Try it online!

Perl 5, 41 + 1 (-p) = 42 bytes
$m=(sort/./g)[-1];s/$m//;($_*=$m)>9&&redo

Try it online!

Fails on input of 9. :( but tinkered a little and managed to get 41 bytes with a fix: Try it online!

Lua, 137 108 bytes
function f(n)while n>9 do b="0"g=b.gsub g(n,".",function(m)b=math.max(m,b)end)n=b*g(n,b,"",1)end print(n)end

Thanks to Jonathan S for golfing off 29 bytes.
Try it online!

108 bytes

Thanks. That looks worthy of an answer of its own - will link to a post you make for it, otherwise will edit & credit.

Just edit it in. It's still your code, I haven't written it from scratch.

Pip, 22 21 bytes
Wa>9a:aRAa@?YMXax*:ya

Takes input as a command-line argument. Verify all test cases: Try it online!
Explanation
Ungolfed, with comments:
                 a is 1st cmdline arg
W a>9 {          While a > 9:
  Y MXa           Yank max(a) into y
  a RA: a@?y ""   Find index of y in a; replace the character at that position with ""
  a *: y          Multiply a by y
}
a                Autoprint a

In the golfed version, the loop body is condensed into a single expression:
a:aRAa@?YMXax*:y
        YMXa      Yank max(a)
     a@?          Find its index in a
  aRA       x     Replace at that index with x (preinitialized to "")
             *:y  Multiply that result by y (using : meta-operator to lower the precedence)
a:                Assign back to a

Scala, 121 bytes
x=>def g(y:Int):Int={if(y>9){val m=y.toString.max.asDigit;g(y.toString.replaceFirst(m.toString,"").toInt*m)}else y}
g(x)}

Try it online!

pure Bash, 116 112 bytes, or 101, or even 97?
Based on answers from iBug and Léa Gris and tips-for-golfing-in-bash (thanks, @AaronMiller and @BrowncatPrograms!):
#!/bin/bash

test112()
{
n=$1;shopt -s extglob;while((n>9));do m=0;for x in ${n//?()/ };{ ((m<x))&&m=$x;};n=$[10#${n/$m/}*m];done;echo $n
}

for k in 9 27 757 1234 26364 432969 1234584 91273716; do printf '%d -> ' "$k"; test112 "$k"; done

Try it online!
Also there are two shorter variants:
#!/bin/bash

f()(shopt -s extglob;(($1>9))||exit $1;m=0;for x in ${1//?()/ };{ ((m<x))&&m=$x;};f $[10#${1/$m/}*m])

for k in 9 27 757 1234 26364 432969 1234584 91273716; do printf '%d -> ' "$k"; f "$k"; echo "$?"; done

(Try it online!) with 101 bytes and with 97 bytes (Try it online!):
shopt -s extglob;(($1>9))||exit $1;m=0;for x in ${1//?()/ };{ ((m<x))&&m=$x;};$0 $[10#${1/$m/}*m]

But I am not entirely sure the last two apply to the rules.  The latter even uses $0 (I neither found a rule allowing that nor denying this) to recurse to itself, so it only works if put into a script (like golf.sh), made executable and then is called like golf.sh 91273716; echo $?
Output of the scripts:
9 -> 9
27 -> 4
757 -> 5
1234 -> 8
26364 -> 8
432969 -> 0
1234584 -> 8
91273716 -> 6

Explained first variant (112 bytes):
n=$1;                           # (*) get argument n
shopt -s extglob;               # enable ${n//?()/ } below
while((n>9));do                 # loop until number is <=9
  m=0;                          # preset maximum to 0
  for x in ${n//?()/ };{        # loop over the digits
    ((m<x))&&m=$x;              # find max
  };
  n=$[                          # calculate new number
      10#                       # force base 10 as 0N becomes octal
         ${n/$m/}               # remove first occurance of max
                 *m];           # multiply m
done;
echo $n                         # output result

Notes:

Shebang #!/bin/bash+LF (12 byte) is not included in the count.

We are in bash, so this is already the default

AFAICS passing in the number directly as variable n (see marked (*) above) is not allowed.  Hence these 5 bytes are needed.

Else ./golf.sh 1234 would look like n=1234 ./golf.sh
A read n; if number is passed in from STDIN is 2 byte longer

shopt -s extglob; can be left away, if this option is given on commandline

Like in n=1234 bash -Oextglob ./golf.sh
But extglob is not set by default, hence AFAICS it must be included in the count

10# is needed as ${n/$m/} can leave a number with a leading 0

Without the 10# input 91273716 wrongly returns 8.

Explained shortest variant (97 bytes):
shopt -s extglob;                           # see above
(($1>9))||exit $1;                          # stop if goal reached
m=0;for x in ${1//?()/ };{ ((m<x))&&m=$x;}; # max calc, as above
$0 $[10#${1/$m/}*m]                         # recurse to next step

Notes:

Actually the last line is a tail recursion, so bash uses exec and does not fork

Welcome to Code Golf, and nice first answer! Make sure to check out our tips for golfing in Bash to see if you can find ways to shorten your code.

Nice answer! For the input, you might want to look through the default I/O rules.

@AaronMiller Thanks for the link! 4 bytes less.

PowerShell, 230 bytes
$n="$args";do{$n=$n.ToString();$a=@();0..$n.Length|%{$a+=$n[$_]};$g=[convert]::ToInt32(($a|sort|select -last 1),10);[regex]$p=$g.ToString();[int]$s=$p.replace($n,'',1);if($n.Length-eq1){$n;exit}else{$r=$s*$g}$n=$r}until($r-lt10)$r

Try it online!
Wasted too much on all the type casting.

J, 40 bytes
((]*<^:3@i.{[)>./)&.(10&#.inv)^:(9&<)^:_

Try it online!
explanation
(      iterate                   )^:(9&<)^:_    NB. keep iterating while the number is > 9
 (     stuff         )&.(10&#.inv)              NB. convert to digits, do stuff, convert back to number
 (           )>./)                              NB. stuff is a hook, with max digit >./  on the right
 (]*<^:3@i.{[)                                  NB. so that in this phrase, ] means "max" and [ means "all digits"
  ]                                             NB. the max digit...
   *                                            NB. times...
    <^:3@                                       NB. triple box...
         i.                                     NB. the first index of the max in the list of all digits
           {                                    NB. "from" -- which because of the triple box means "take all indexes except..."
            [                                   NB. from all the digits of the number

I learnt about the triple box selection from you today, thank you!

Kotlin, 109 bytes
fun f(n:Int):Int{return if(n>9){val m=(""+n).max()!!;f((""+n).replaceFirst(""+m,"").toInt()*(m-'0'))}else n}

Bash, 80 bytes
Uses packages Core Utilities (for sort and tail) and grep.
while((n>9));do m=$(grep -o .<<<$n|sort|tail -n1);n=$((${n/$m/}*m));done;echo $n

How does it work?
while (( n > 9 )); do  # C-style loop conditional
    grep -o .          # Separate the string into one char per line
              <<< $n   # Use the content of variable `n` as its stdin
    | sort             # Pipe to `sort`, which sorts strings by line
    | tail -n 1        # Take the last line

m=$(                 ) # Assign the output of the command chain to `m`
n=$((          ))      # Assign the result of the evaluation to n
     ${n/$m/}          # Replace the first occurrence of $m with empty
             *m        # ... and multiply it by the value of `m`
done; echo $n          # After loop, print the value of `n`

Use $[${n/$m/}*m] instead of $((${n/$m/}*m)) for -2 bytes

Code fails on 91273716.  Fix: Use $[10#${n/$m/}*m], adds +3 bytes to 81.

And if you replace $(..) with backticks (I do not know how to present a backtick here in comments, sorry), that brings us back to 80 bytes again ;)

PHP, 82 77+1 bytes
for($n=$argn;$n>9;)$n=join("",explode($d=max(str_split($n)),$n,2))*$d;echo$n;

Run as pipe with -nR or try it online.

dc, 98 85 bytes
?dsj[0dsosclj[soIlc^sr0]sn[I~dlo!>nrlc1+scd0<i]dsixljdlr%rlrI*/lr*+lo*dsj9<T]sT9<Tljp

Many thanks to this answer for the idea of utilizing ~ in the extraction of digits from a number, resulting in two saved bytes over the original version of the code.
This was a rather though one to complete in dc with its nonexistent string manipulation capabilities.
Try it online!

APL NARS 42 40 36 chars
{⍵≤9:⍵⋄∇h⌷v×10⊥v[(⍳⍴v)∼h←1⌷⍒v←⍎¨⍕⍵]}

some test, I copied the trick ⍎¨⍕ from Adam solution
g←{⍵≤9:⍵⋄∇h⌷v×10⊥v[(⍳⍴v)∼h←1⌷⍒v←⍎¨⍕⍵]}

  g¨9 27 757 1234 26364 432969 1234584 91273716
9 4 5 8 8 0 8 6

{⍵≤9:⍵   if ⍵≤9 return ⍵
 ∇h⌷v×10⊥v[(⍳⍴v)∼h←1⌷⍒v←⍎¨⍕⍵]
                      v←⍎¨⍕⍵] convert ⍵ in the list of integer digits (not chars) in v
                 h←1⌷⍒v       puts in h the index of the first element max that appear in v
           v[(⍳⍴v)∼h           gets from v only the indices for digits different from h
        10⊥                   convert that modify v[]sub array to a number in base 10
 ∇h⌷v×            multiply it with v[h], and recall the same function for this number
}

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Regex: Match an egalitarian series
Introduction
I don't see many regex challenges on here, so I would like to offer up this deceptively simple one which can be done in a number of ways using a number of regex flavours. I hope it provides regex enthusiasts with a bit of fun golfing time.
Challenge
The challenge is to match what I've very loosely dubbed an "egalitarian" series: a series of equal numbers of different characters. This is best described with examples.
Match:
aaabbbccc
xyz
iillppddff
ggggggoooooollllllffffff
abc
banana

Don't match:
aabc
xxxyyzzz
iilllpppddff
ggggggoooooollllllfff
aaaaaabbbccc
aaabbbc
abbaa
aabbbc

To generalize, we want to match a subject of the form (c1)n(c2)n(c3)n...(ck)n for any list of characters c1 to ck, where ci != ci+1 for all i, k > 1, and n > 0.
Clarifications:

Input will not be empty.

A character may repeat itself later in the string (eg. "banana")

k > 1, so there will always be at least 2 different characters in the string.

You can assume only ASCII characters will be passed as input and no character will be a line terminator.

Rules
(Thank you to Martin Ender for this excellently-stated block of rules)
Your answer should consist of a single regex, without any additional code (except, optionally, a list of regex modifiers required to make your solution work). You must not use features of your language's regex flavour that allow you to invoke code in the hosting language (e.g. Perl's e modifier).
You can use any regex flavour which existed before this challenge, but please specify the flavour.
Do not assume that the regex is anchored implicitly, e.g. if you're using Python, assume that your regex is used with re.search and not with re.match. Your regex must match the entire string for valid egalitarian strings and yield no matches for invalid strings. You may use as many capturing groups as you wish.
You may assume that the input will always be a string of two or more ASCII characters not containing any line-terminators.
This is regex golf, so the shortest regex in bytes wins. If your language requires delimiters (usually /.../) to denote regular expressions, don't count the delimiters themselves. If your solution requires modifiers, add one byte per modifier.
Criteria
This is good ol' fashioned golf, so forget efficiency and just try to get your regex as small as possible.
Please mention which regex flavour you have used and, if possible, include a link showing an online demo of your expression in action.

Is this specifically a regex golf? You should probably clarify that, along with the rules for it. Most challenges on this site are golfs of assorted programming languages.

@LyricLy Thanks for the advice! Yes, I would like it to be purely regex, ie. a single regular expression in a regex flavour of the submitter's choice. Are there any other rules I should be mindful of including?

I don't understand your definition of "egalitarian", such that banana is egalitarian.

@msh210 When I came up with the term "egalitarian" to describe the series, I didn't consider that I would allow characters to be repeated later in the series (such as in "banana", or "aaabbbcccaaa", etc.). I just wanted a term to represent the idea that every chunk of repeated characters is the same size. Since "banana" has no repeated characters, this definition holds true for it.

.NET flavour, 48 bytes
^(.)\1*((?<=(\5())*(.))(.)(?<-4>\6)*(?!\4|\6))+$

Try it online! (using Retina)
Well, turns out that not negating the logic is simpler after all. I'm making this a separate answer, because the two approaches are completely different.
Explanation
^            # Anchor the match to the beginning of the string.
(.)\1*       # Match the first run of identical characters. In principle,
             # it's possible that this matches only half, a quarter, an
             # eighth etc of of the first run, but that won't affect the
             # result of the match (in other words, if the match fails with
             # matching this as the entire first run, then backtracking into
             # only matching half of it won't cause the rest of the regex to
             # match either).
(            # Match this part one or more times. Each instance matches one
             # run of identical letters.
  (?<=       #   We start with a lookbehind to record the length
             #   of the preceding run. Remember that the lookbehind
             #   should be read from the bottom up (and so should
             #   my comments).
    (\5())*  #     And then we match all of its adjacent copies, pushing an
             #     empty capture onto stack 4 each time. That means at the
             #     end of the lookbehind, we will have n-1 captures stack 4,
             #     where n is the length of the preceding run. Due to the
             #     atomic nature of lookbehinds, we don't have to worry
             #     about backtracking matching less than n-1 copies here.
    (.)      #     We capture the character that makes up the preceding
             #     run in group 5.
  )
  (.)        #   Capture the character that makes up the next run in group 6.
  (?<-4>\6)* #   Match copies of that character while depleting stack 4.
             #   If the runs are the same length that means we need to be
             #   able to get to the end of the run at the same time we
             #   empty stack 4 completely.
  (?!\4|\6)  #   This lookahead ensures that. If stack 4 is not empty yet,
             #   \4 will match, because the captures are all empty, so the
             #   the backreference can't fail. If the stack is empty though,
             #   then the backreference will always fail. Similarly, if we
             #   are not at the end of the run yet, then \6 will match
             #   another copy of the run. So we ensure that neither \4 nor
             #   \6 are possible at this position to assert that this run
             #   has the same length das the previous one.
)+
$            # Finally, we make sure that we can cover the entire string
             # by going through runs of identical lengths like this.

I love that you seesawed between the two methods! I also thought the negative approach ought to have been shorter until I actually attempted it and found it a lot more awkward (even though it feels like it should be simpler). I have 48b in PCRE, and 49b in Perl with a completely different method, and with your 3rd method in .NET around the same size, I'd say this is quite a cool regex challenge :D

@jaytea I'd love to see those. If no one comes up with anything for a week or so, I hope you'll post them yourself. :) And yeah agreed, it's nice that the approaches are so close in byte count.

I just might! Also, Perl one has been golfed down to 46b ;)

So I figured you might want to see these now! Here's 48b in PCRE: ((^.|\2(?=.*\4\3)|\4(?!\3))(?=\2*+((.)\3?)))+\3$ I was experimenting with \3* in place of (?!\3) to make it 45b but that fails on "aabbbc" :( The Perl version is easier to understand, and it's down to 45b now: ^((?=(.)\2*(.))(?=(\2(?4)?\3)(?!\3))\2+)+\3+$ - the reason I call it Perl even though it appears to be valid PCRE is that PCRE thinks (\2(?4)?\3) could recurse indefinitely whereas Perl is a little smarter/forgiving!

@jaytea Ah, those are really neat solutions. You should really post them in a separate answer. :)

Thanks :) I may do when I have time to write out explanations

.NET flavour, 54 bytes
^(?!.*(?<=(\2)*(.))(?!\2)(?>(.)(?<-1>\3)*)(?(1)|\3)).+

Try it online! (using Retina)
I'm pretty sure this is suboptimal, but it's the best I'm coming up with for balancing groups right now. I've got one alternative at the same byte count, which is mostly the same:
^(?!.*(?<=(\3())*(.))(?!\3)(?>(.)(?<-2>\4)*)(\2|\4)).+

Explanation
The main idea is to invert the problem, match non-egalitarian strings and put the whole thing in a negative lookahead to negate the result. The benefit is that we don't have to keep track of n throughout the entire string (because due to the nature of balancing groups, you usually consume n when checking it), to check that all runs are of equal length. Instead, we just look for a single pair of adjacent runs that don't have the same length. That way, I only need to use n once.
Here is a breakdown of the regex.
^(?!.*         # This negative lookahead means that we will match
               # all strings where the pattern inside the lookahead
               # would fail if it were used as a regex on its own.
               # Due to the .* that inner regex can match from any
               # position inside the string. The particular position
               # we're looking for is between two runs (and this
               # will be ensured later).

  (?<=         #   We start with a lookbehind to record the length
               #   of the preceding run. Remember that the lookbehind
               #   should be read from the bottom up (and so should
               #   my comments).
    (\2)*      #     And then we match all of its adjacent copies, capturing
               #     them separately in group 1. That means at the
               #     end of the lookbehind, we will have n-1 captures
               #     on stack 1, where n is the length of the preceding
               #     run. Due to the atomic nature of lookbehinds, we
               #     don't have to worry about backtracking matching
               #     less than n-1 copies here.
    (.)        #     We capture the character that makes up the preceding
               #     run in group 2.
  )
  (?!\2)       #   Make sure the next character isn't the same as the one
               #   we used for the preceding run. This ensures we're at a
               #   boundary between runs.
  (?>          #   Match the next stuff with an atomic group to avoid
               #   backtracking.
    (.)        #     Capture the character that makes up the next run
               #     in group 3.
    (?<-1>\3)* #     Match as many of these characters as possible while
               #     depleting the captures on stack 1.
  )
               #   Due to the atomic group, there are three two possible
               #   situations that cause the previous quantifier to stopp
               #   matching.
               #   Either the run has ended, or stack 1 has been depleted.
               #   If both of those are true, the runs are the same length,
               #   and we don't actually want a match here. But if the runs
               #   are of different lengths than either the run ended but
               #   the stack isn't empty yet, or the stack was depleted but
               #   the run hasn't ended yet.
  (?(1)|\3)    #   This conditional matches these last two cases. If there's
               #   still a capture on stack 1, we don't match anything,
               #   because we know this run was shorter than the previous
               #   one. But if stack 1, we want to match another copy of
               #   the character in this run to ensure that this run is
               #   longer than the previous one.
)
.+             # Finally we just match the entire string to comply with the
               # challenge spec.

I tried to make it fail on: banana, aba, bbbaaannnaaannnaaa, bbbaaannnaaannnaaaaaa, The Nineteenth Byte, 11, 110, ^(?!.*(?<=(\2)*(.))(?!\2)(?>(.)(?<-1>\3)*)(?(1)|\3)).+, bababa. It's me who failed. :( +1

That moment when you finish your explanation and then figure out that you can save 1 byte by using the exact opposite approach... I guess I'll make another answer in a bit... :|

@MartinEnder ... And then realise you could golf this one by 2 bytes haha :P

@Mr.Xcoder Would have to be 7 bytes now, so I hope I'm safe. ;)

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
The sequence of range-exponentiated integers
Consider a triangle where the Nth row (1-indexed) is the array of the first N positive integer powers of N. Here are the first few rows:

N | Triangle

1 | 1
2 | 2 4
3 | 3 9 27
4 | 4 16 64 256
5 | 5 25 125 625 3125
...

Now if we concatenate those powers into a single sequence, we get OEIS A075363:
1, 2, 4, 3, 9, 27, 4, 16, 64, 256, 5, 25, 125, 625, 3125, 6, 36, 216, 1296, 7776, 46656 ...

Given an integer N, your task is to return the Nth term of this sequence. You can choose either 0 or 1-indexing.
Test cases
1-indexed:

N  -> Output

1  -> 1
2  -> 2
3  -> 4
5  -> 9
10 -> 256
12 -> 25
15 -> 3125

0-indexed:

N  -> Output

0  -> 1
1  -> 2
2  -> 4
4  -> 9
9  -> 256
11 -> 25
14 -> 3125

Note that these loopholes are forbidden by default. This is code-golf, thus the  shortest valid submission in each language wins!

I think there is some error in test cases: in 1-indexed 10 should be  256; in 0-indexed 9 should be 256.

Can we have trailing spaces?

@StanStrum Yes.

Python 3, 39 bytes
1-indexed

f=lambda x,n=1:n**x*(x<=n)or f(x-n,n+1)

Try it online!

Husk, 7 bytes
!ṁṠM^ḣN

Try it online!
1-indexed
Explanation:
      N   Get the list of all natural numbers
 ṁ        Map over each n in that list and then concatenate
  Ṡ  ḣ      Create the range [1,n] then ...
   M^       raise n to the power of each
!         Index into that sequence

Wolfram Language (Mathematica), 32 bytes
r=Range;Flatten[r@#^r@r@#][[#]]&

Try it online!
Ranges to the power of ranges of ranges...

Range@Range@3 returns {{1}, {1, 2}, {1, 2, 3}}?! Damn, Mathematica's list-threading is insane.

APL (Dyalog), 15 13 10 bytes
3 bytes saved thanks to @Adám
⊢⊃∘∊⍳*⍳¨∘⍳

Try it online!
How?
⍳¨∘⍳ - create a range for each number in the range of input
⍳* - raise each number in the range of input to the corresponding powers
∊ - flatten
⊢⊃ - pick the nth element

Trying it online the code appears to be 17 bytes and it does not appear to accept a scalar integer argument or produce a single integer output

@Graham Online, the code is assigned to a variable f (thus f← is 2 more bytes, which is not counted here), and there is a test harness that returns the results from 1 to 10.

Surely you must count all bytes including any such assignments and those required to take in the input according to the question spec and to output according to the spec. My APL answer prompts for screen input.

@Graham this is a dyalog APL dfns. It does not require assignment to be applied on any input, the TIO outlet is just for comfortable view

On that basis can I assume I can assign n within my workspace prior to running the APL one liner and thereby save 7 bytes, I am not sure our fellow competitors will accept that.

@Graham no, you can't. Where do you see any variable assigned? I only assign f to show the almost-exact byte count in the link, but it can be run as well without it. One of the highest upvoted IOs in meta is input through function arguments, and that's what this solution uses. And since you got a response, please remove the falsy comments. They distract other people.

@Graham your solution uses direct input rather than a tradfn or dfns - therefore you assign n. This one doesn't need to, as well as the third APL solution here.

OK I am not familiar with dfns or "input through function arguments" so if others here are content with your approach I withdraw my falsy comments. I would still like to see how your line of code would produce an answer with no other input

@Graham like that

Let us continue this discussion in chat.

R, 40 bytes
-2 bytes porting Halvard Hummel's answer
function(N){while(N>T){N=N-T;T=T+1};T^N}

Try it online!
R, (original answer) 42 bytes
function(N)(rep(1:N,1:N)^sequence(1:N))[N]

Try it online!
1-indexed.

Haskell, 30 28 bytes
Saved 2 bytes thanks to xnor.
([n^m|n<-[1..],m<-[1..n]]!!)

Try it online!
0-indexed

It's actually shorter to use the list comp [n^i|n<-[1..],i<-[1..n]].

Oh, I was comparing it to the >>= form ...

APL (Dyalog), 14 12 bytes
{⍵⌷∊*∘⍳⍨¨⍳⍵}

Try it online!
Uses 1-indexing
Saved 2 bytes with ↑,/ → ∊, taken from Graham's answer
Note that in the test link, the code requires an extra f←, but this is not counted as per our rules.

Very clever use of ∘ with ⍨.

{⍵⌷∊*∘⍳⍨¨⍳⍵} → ⊢⌷∘∊((*∘⍳)⍨¨⍳) → ⊢⌷∘∊(⍳(*∘⍳)¨⍳) → ⊢⌷∘∊⍳*∘⍳¨⍳

I would post that... if I had any idea how that worked

⊢ is to a tacit function what ⍵ is to a dfn. The ∘ between ⌷ and ∊ is needed because ∊ is called monadically, so it is index the enlisted. And we change f⍨⍳ into ⍳ f ⍳ to avoid calling f (*∘⍳¨) monadically (whenever ⍨ and ¨ are adjacent, they may swap position).

MATL, 9 bytes
:t!^RXzG)

Indexing is 1-based. Try it online! Or verify all test cases.
Explanation
Consider input 5 as an example.
:     % Implcit input n. Push range [1 2 ... n]
      % STACK: [1 2 3 4 5]
t!^   % Matrix of all pair-wise powers
      % STACK: [1    2    3    4    5;
                1    4    9   16   25;
                1    8   27   64  125;
                1   16   81  256  625;
                1   32  243 1024 3125]
R     % Upper triangular matrix
      % STACK: [1    2    3    4    5;
                0    4    9   16   25;
                0    0   27   64  125;
                0    0    0  256  625;
                0    0    0    0 3125]
Xz    % Nonzeros. Reads values in column-major order
      % STACK: [1; 2; 4; 3; 9; ...; 625; 3125]
G)    % Get n-th entry (1-based). Implcit display
      % STACK: 9

Pyth, 8 bytes
@s^RSdSh

Try it here.
-1 thanks to Steven H..
0-indexed.

@s^RSdSh to golf a byte off.

Jelly, 7 bytes
*R$€Ẏ⁸ị

Try it online!
-1 thanks to Mr. Xcoder.
1-indexed.

Awesome code right here.

Getting rid of fancy syntax with ", my own solution is 7 bytes: *R$€F⁸ị

@Mr.Xcoder Thanks, although I had already removed the ", but still. That's what you get for having to study history :/

05AB1E, 9 bytes
ƒNDLm`}I@

Try it online!
Explanation
1-indexed.
ƒ           # for N in range [0 ... input]
 N          # push N
  DL        # push range [1 ... N]
    m       # raise N to the power of each in [1 ... N]
     `      # flatten to stack
      }     # end loop
       I@   # get the element at index (input)

Alternative solution over a list instead of a loop
ÝεDLm}˜sè

Perl 6, 29 bytes
{({|($++X**1..$++)}...*)[$_]}

Test it
Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  (  # generate the sequence

    {  # code block used to generate each value in the sequence

      |(         # slip the values into the outer sequence

        $++      # post-incremented anonymous state value
        X**      # cross using &infix:«**»
        1 .. $++ # from 1 to post-incremented anonymous state value

      )
    }

    ...          # keep generating values until

    *            # never stop

  )[ $_ ]        # index into the sequence (0-based)
}

Ruby, 34 bytes
->n{w=0;n-=w+=1until n<0;w**=w-~n}

Try it online!

JavaScript, 30 bytes
-1 byte thanks to  Nahuel Fouilleul
f=(x,n=1)=>x>n?f(x-n,n+1):n**x

Try it online!

-1 byte inverting the test f=(x,n=1)=>x>n?f(x-n,n+1):n**x

@NahuelFouilleul of course, thank you!

APL+WIN, 23 bytes
(∊n↑¨⊂[2]n∘.*n←⍳n)[n←⎕]

Explanation:
[n←⎕] prompts for screen input and selects the nth element of the concatenated vector
see below

n←⍳n creates a vector of 1 to n

∘.* outer product with exponentiation as the operator

⊂[2] enclose each row of the resulting array as an element of a nested array

∊n↑¨ take 1 to n elements from the 1 to nth row of the matrix and concatenate into a vector

What APL dialect does this work on?

It is written in APL+WIN. I will make this clear in any future answers

I took ∊ from your answer to replace my ↑,/. I didn't know of that function. Thanks

@EriktheOutgolfer I think this will work on any modern APL.

Perl 5, 30+1 (-p) bytes
$_-=$.++until$.>$_;$_=$.**++$_

try it online

J, 20 bytes
{1,[:;[:(^&.><\)1+i.

1-indexed
Try it online!

S.I.L.O.S, 45 bytes
readIO
lblb
a+1
i-a
if i b
i+a
a^i
printInt a

Try it online!

Clojure 51 bytes
0-indexed, for example input 9 returns 256.0.
#(nth(for[i(range)j(range i)](Math/pow i(inc j)))%)

Python 2, 57 bytes
lambda N:[n**-~e for n in range(N+2)for e in range(n)][N]

Try it online! (0-indexed.)
0-indexed alternative 74 bytes long version.

Jelly,  15  12 bytes
Probably not optimal.
-3 thanks to Erik the Outgolfer's golfing.
=RṁR€T€µT*FḢ

Try it online!

Wow, you must be really tired today.

I'm actually really ill!

Sorry! Hope you get better soon!

Also, here is some 3 bytes off I managed to pluck out of this trivially.

C 76, 62 bytes
y;f(n){for(y=0;n>y*++y/2;);return(int)pow(y-1,n+y*(3-y)/2-1);}

y;f(n){y=(int)(-.5+sqrt(1+8*~-n)/2)+2;n+=y*(3-y)/2-1;return(int)pow(y-1,n);}
I based it on this code
Try it on ideone

Pyt, 39 37 bytes
1-indexed
←000`ŕŕ⁺ĐĐř^Đ04Ș↔+⇹Ł-Đ↔3Ș0>łŕ0↔⇹+⁻⦋↔ŕ

Explanation:
Briefly, it calculates each row. If the requested number is in that row, return it; otherwise, go to the next row.


text:
Ain't no thang! ...or is it?
Introduction
Street talk can be really difficult to understand, in particular to programmers, who aren't known to be very streetwise.
It is your job to create an interpreter to help us all survive in the urban environment.
Challenge
Given an English sentence as input, create a program or a function that determines whether the outcome of the sentence is positive or negative.
The sentence will contain 0 to 2 negative words. As any programmer knows, a double negative results in a positive. Therefore, your code must output or return a truthy/falsey value according to the following rule:
No negative words  -> truthy
One negative word  -> falsey
Two negative words -> truthy

The list of negative words:

no, not, none
Anything ending in n't
never, neither, nor
nobody, nothing, nowhere

There is one edge case. Whenever a sentence begins with No,, that word isn't treated as a negative word when determining the result (it does count towards the number of negative words so there can be just one more).
The sentence will follow basic grammar rules (capitalization, punctuation) and will only contain words that can be found from a dictionary (luckily, this doesn't invalidate the question title). The sentence won't contain any proper nouns (sorry, Dr. No, you're out).
Test cases
Truthy:
Yes.
It's noon.
Hello, World!
What is this?
Ain't no thang!
Never say never.
No, it's noon now.
Neither me nor you.
I didn't do nothing!
No, I am your father.
A non-alcoholic drink.
I can't get no satisfaction.
All your base are belong to us.

Falsey:
No.
No, no!
Not today.
Neither am I.
Don't do that!
That's no moon!
And none survived.
Is this not my car?
No man is an island.
Nosebleeds are no fun.
Nothing compares to you.
That's a no, I'm afraid.
No, I am not your mother.

The irony here, of course, is that some of these should be interpreted differently. But hey, you can't fault the speaker for not conforming to our logic.
Rules
Standard loopholes are forbidden. This is code-golf, so be concise!

Nobody ain't never been neither nowhere nor nothing.

@MagicOctopusUrn: You can lose the been for a 100% negative sentence!

Retina, 63 bytes
No,

Mi`\bn(e(ith|v)er|o(|body|ne|r|t|thing|where))\b|n't\b
0|2

Try it online!
Explanation
No,

Remove No, from the input. Due to the capitalisation rules, this can only appear at the beginning of the input, so we don't need an explicit ^.
Mi`\bn(e(ith|v)er|o(|body|ne|r|t|thing|where))\b|n't\b

Count the number of matches of the case-insensitive regex after the `. It just matches all the relevant words, where I've extracted common prefixes/suffixes with the alternatives.
0|2

Count 0 or 2s, so we turn even counts into 1 and odd counts into 0.

do you do the common letter extraction by hand or use a program that finds the optimal solution for you?

@Jonah I did that by hand. There are tools for automated regex metagolf, but they usually take two lists, one to match and one to fail, and generate a regex for that. I'm not aware of any tool that generates an optimal regex to match a particular set of substrings in a larger string.

could make an interesting challenge...

You should be able to assume that n't doesn't need \b after it, since the words have to come from a dictionary. Also, I had the same thing, but I didn't have the meat of the answer as concisely, using a couple more bytes.

Bash, 115 107 99 98 97 95 85 bytes
Uses packages Core Utilities (for wc) and grep. Assume the sentence is given via Standard Input. History expansion is disabled by set +o histexpand.
((~`grep -Pio "(?!^no,)\b(no(|t|r|ne|body|thing|where)|ne(v|ith)er|.*n't)\b"|wc -l`%2))

Check the result: In Bash 0 is for true, 1 is for false
How does it work?
((                       )) # Logical evaluation: non-zero to TRUE, zero to FALSE
  ~                    %2   # C-style arithmetic: Bit-Negate and Modulus 2
   $(                 )     # Output of the program chain
     grep -Pio "regex"      # PCRE match, ignore case, output matching part one-per-line
     | wc -l                # Pipe to `wc` and count number of lines

18 bytes (115 to 99) saved by inspiration from Qwertiy's answer and Martin Ender's answer. 1 byte thanks to Nahuel Fouilleul.

regex is not correct : matches noon and not That's a no, I'm afraid.

@NahuelFouilleul Fixed.

to check: tio however couldn't paste tests because comment length limit

this gives right results ((~$(grep -Pio "(?!^no,)\b(no(|t|r|ne|body|thing|where)|ne(v|ith)er)\b|.*n't\b"|wc -l)%2))

back quotes instead of $(..) save 1 byte

@NahuelFouilleul Sorry for a parenthesis misplacement. Check my current answer.

71 bytes : here

@NahuelFouilleul I'm afraid the neil brothers will give a wrong result, as well as never.

Javascript ES6, 89 87 86 chars
s=>s.match(/(?!^no,)\bn(o(|t|r|ne|body|thing|where)|e(v|ith)er)\b|n't\b|$/ig).length&1

Test:

f=s=>s.match(/(?!^no,)\bn(o(|t|r|ne|body|thing|where)|e(v|ith)er)\b|n't\b|$/ig).length&1

console.log(`Yes.
It's noon.
Hello, World!
Never say never.
Ain't no thang!
No, it's noon now.
Neither me nor you.
I didn't do nothing!
No, I am your father.
A non-alcoholic drink.
I can't get no satisfaction.
All your base are belong to us.`.split`
`.every(f))

console.log(`No.
No, no!
Not today.
Neither am I.
Don't do that!
That's no moon!
And none survived.
No man is an island.
Nosebleeds are no fun.
Nothing compares to you.
That's a no, I'm afraid.
No, I am not your mother.`.split`
`.every(s=>!f(s)))

Perl 5, 74 bytes
73 bytes code + 1 for -p.
s/No,//;$_=!(s/(\bn(o(r|t|ne|body|thing|where)?|e(v|ith)er)|n't)\b//gi%2)

Try it online!


text:
How to reduce EXE size of x86 ASM compiled with FASM?
As an exercise, I've created a simple solution for this challenge, in x86 Assembly Language. I'm running this with FASM on Windows. Here's my source code:
format PE console
entry start

include 'WIN32A.inc'

section '.text' code executable
start:
    push    char            ; Start at 'A'
    call    [printf]        ; Print the current letter 4 times
    call    [printf]
    call    [printf]
    call    [printf]
    inc     [char]          ; Increment the letter
    cmp     [char], 'Z'     ; Compare to 'Z'
    jle     start           ; char <= 'Z' --> goto start

section 'r.data' data readable writeable
    char    db  'A', 10, 0  ; Stores the current letter

section '.idata' data readable import
    library  msvcrt,   'msvcrt.dll'
    import   msvcrt, printf, 'printf'

When I compile this, I get an executable larger than I expected. Here's a hexdump:
https://pastebin.com/W5sUTvTe
I notice there's a lot of empty space between the code section and the data and library import sections, as well as a message saying "This program cannot be run in DOS mode" embedded in the code. How can I assemble my source code to a small file, suitable for Code Golf?
As a side note, suggestions for better ways to print to stdout without importing msvcrt and calling printf are welcome.

@iBug I'm sorry to hear that. Could you please suggest a more suitable place for me to ask?

@iBug Tips questions asking for golfing help in specific cases are most definitely not off-topic here.

Relevant meta

Machine assembly code contains a lot of boilerplate, so often people submit functions instead of programs.

Although, in this case, the question explicitly require programs, so golfing the resulting generated program is necessary.

Check out this answer: https://codegolf.stackexchange.com/a/86106/51429
How did he do that?

@user3284178 MS-DOS full program boilerplate is often smaller. So, just use MS-DOS instead.

It has to be: start:
push    char
Lb:    call    [printf]
call    [printf]
call    [printf]
call    [printf]
inc     [char]
cmp     [char], 'Z'
jle     Lb because if not, could be consume the stack; one has to see if each call to printf one has to add the instruction that adjust esp

Not sure this is still working, but you might want to try targeting Linux instead and put part of your code in the ELF header itself like described here.

@user202729 it has to be: start: push char Lb: call [printf] pop eax call [printf] pop eax call [printf] pop eax call [printf] pop eax inc [char] cmp [char], 'Z' jle Lb because if not, it would exhaust the stack memory; one has to see if each call to printf one has to add the instruction that adjust esp. It is better?

golfing the file format is quite different from golfing the code, though.  Now we're getting into specifics of the operating-system version because restrictions changed between 32-bit and 64-bit, and even between versions of the same.  See http://pferrie.host22.com/misc/tiny/pehdr.htm for tips to build your own file header, and Crinkler has code to tiny resolve imports at runtime.

instead of printf, you can WriteFile(stdout), needing no imports other than kernel32 (which is present by default, you just need to determine the address)

Quite a bit general tip, but
Use COM file format instead of PE EXE.
PE EXE has a few flaws making the format pretty much useless in code-golf. First one is the image aligning (Windows won't run the EXE file if it's not aligned properly), and the second one is the header size. There are a few factors that aren't this important (dividing the executable into sections).
Advantages of using COM file format (that is pretty much equivalent to flat binary) are:

Zero header code, file isn't divided into sections
No image aligning (so the image size might not be divisible by a strictly defined power of two, but it has to be smaller than 65K. It doesn't change much though, because if your submission is larger than 65K, you're doing something wrong).
You can't use external libraries - this is actually a plus, because you without doubt have other way to perform I/O. That's where BIOS interrupts come handy.
You have direct control over the memory and devices linked up to the system, therefore there is no paging, no access violations, no memory protection, no concurrency, so on and so forth. These features make it easier to golf really creative programs.

I've revised your code to work as flat binary. It's dead simple:
ORG 100H

MOV DX, P
MOV AH, 9

L:
    INT 21H
    INT 21H
    INT 21H
    INT 21H

    INC BYTE [P]
    CMP BYTE [P], 'Z'
    JLE L

MOV AX, 4C00h
INT 21h

P DB "A", 10, "$"

The output binary is just 32 bytes big. I believe, it's possible to reduce the size even further, but this is just a starting point.
Assemble with nasm -fbin file.asm -o file.com. Note, this example has been made for NASM, but you can translate it freely to FASM, and it will work flawlessly.


text:
The Shield Wall
Historical Background
The shield wall is a tactical war formation that dates back to at least 2500 BC. It consisted of warriors overlapping their shields with those of their companions to form a 'wall'. The appeal of the tactic comes from the fact that even the most unskilled warrior could fight in a wall as long as they had a shield and a weapon. Because of the proximity of the walls, there was little space to move around, and the battle usually became a shoving match fought with sharp weapons.
The Challenge
Your task is to create a program or function that, given two arrays/lists/vectors of warriors as input, decides the outcome of the battle. The lists will represent a single-line wall of shields, and they will follow a specific notation:
Vikings:
The nordic warriors had a fierce drive for battle. During the late 8th through the mid 11th centuries, Danish vikings invaded the kingdoms of Britain looking for riches and farmable land.
For the purpose of this challenge, these are the vikings' warriors:

The Jarl: Usually found leading his men from the center of the wall, jarls were the leaders of the viking hordes. Takes 15 damage to die, and deals 2 damage per round.
The Berserker: Although fantasy has greatly twisted the image of the berserkers, these warriors were known to fight in a trance-like fury without any kind of protection other than their shields. Takes 6 damage to die, and deals 3 damage per round.
The Chieftain: Chieftains were rich men who had free men at their service. They'd usually have earned great glory and riches in battle. Takes 10 damage to die, and deals 2 damage per round.
The Free Men: Warriors that served a chieftain. They were sworn to fight for their lords until death. Takes 8 damage to die, and deals 1 damage per round.
The Skald: Skalds, usually translated as bards, were free men who were hired to write poems, stories or songs about the great deeds of the nordic warriors. Takes 8 damage to die, and gives each adjacent warrior 1 bonus damage. Skalds deal no damage. Warriors cannot gain more than 1 bonus damage this way.

Saxons:
The Saxons came to settle in Britain from continental Europe following the demise of the Roman Empire in the 5th century. For the purposes of this challenge, there are the saxons' warriors:

The Earl: Ealdormen, commonly called Earls, were members of the higher nobility. They usually held great streches of land and had hundreds or even thousands of sworn men. Takes 20 damage to die, and deals 1 damage per round.
The Knight: For lack of a better term, the knights were minor noblemen who owned some land. In most cases, knights were sworn servants to an Earl. Takes 10 damage to die, and deals 2 damage per round.
The Warrior: Common men, usually minor noblemen without land or peasants who served a knight. When adjacent to a Knight or Earl, warriors have a +1 damage bonus. Takes 8 damage to die, and deals 2 damage per round.
The Fyrd: The Fyrd was a militia-like group of free men, usually poor farmers, who'd bring any weapon (or weapon-like farming implement) they had to fight in the wall. Takes 5 damage to die, and deals 1 damage per round.
The Priest: Priests were highly valued in early Saxon culture, being heralds of the words of God. Priests take 15 damage to die, and prevent up to 1 damage each adjacent warrior would be dealt. Priests deal no damage. Priests cannot prevent more than 1 damage to a warrior.

The Wall
Walls meet each other at their centers. Each round, each warrior assigns damage to the warrior directly in front of it or, if there's no living warrior in front of it, the diagonally adjacent living warrior with least health remaining. If there is a tie, choose the warrior closer to the edge of the wall.
Example:
Vikings
[M,M,M,B,B,C,J,C,B,B,M,M,M]
[F,F,F,W,W,K,E,K,W,W,F,F,F]
Saxons

To make matters easier, let's convert these walls into numbers:
Round 0:
 M M M B B C  J  C  B B M M M
[8,8,8,6,6,10,15,10,6,6,8,8,8]
[5,5,5,8,8,10,20,10,8,8,5,5,5]
 F F F W W K  E  K  W W F F F

Round 1: Notice that 2 of the Saxons' warriors are adjacent to Knights, so they have a +1 damage bonus.
 M M M B B C J  C B B M M M
[7,7,7,4,3,8,14,8,3,4,7,7,7]
 | | | | | | || | | | | | |
[4,4,4,5,5,8,18,8,5,5,4,4,4]
 F F F W W K E  K W W F F F

Round 2:
 M M M B B C J  C B B M M M
[6,6,6,2,0,6,13,6,0,2,6,6,6]
 | | | | | | || | | | | | |
[3,3,3,2,2,6,16,6,2,2,3,3,3]
 F F F W W K E  K W W F F F

Round 3: Remember to collapse the arrays to account for dead warriors. Also, notice that the 2 outermost Fyrd are now attacking the diagonally adjacent viking.
   M M M B C J  C B M M M
  [4,5,4,0,4,12,4,0,4,5,4]
  /| | | | | || | | | | |\
[2,2,2,1,0,4,14,4,0,1,2,2,2]
 F F F W W K E  K W W F F F

Round 4: Notice once again the saxon Warriors next to the Knights dealing 3 damage:
   M M M C J  C M M M
  [2,4,1,2,11,2,1,4,2]
  /| | | | || | | | |\
[2,1,1,0,2,12,2,0,1,1,2]
 F F F W K E  K W F F F
Round 5:
 M M M C J  C M M M
[1,3,0,0,10,0,0,3,1]
 | | | | || | | | |
[1,0,0,0,10,0,0,0,1]
 F F F K E  K F F F

Round 6:
    M M J M M
   [1,2,9,2,1]
     \| | |/
     [0,8,0]
      F E F
Rounds 7 and 8:
      M M J M M         M M J M M
     [1,2,8,2,1]       [1,2,8,2,1]
         \|/               \|/
         [4]               [0]
          E                 E

Output: Viking victory.

Rules:

Default Loopholes apply.
You can use any convenient IO method.
This is code-golf, so shortest code (in bytes, per language) wins.
You may not assume the lists will have the same length, but they will always be alignable at their centers (there will always be an odd number of warriors in each list if the lists are of different sizes).
You may output any truthy/falsey value. Please specify in your answer the equivalents of "Viking/Saxon victory".
The loser is determined when all the warriors of a wall are dead.
If you ever end up with walls that are not alignable during the code execution, align them as centrally as possible, leaving one extra warrior on the longer wall to the right side.
E.g.:
  [M,M,M,J,M,M,M]
    [K,E,K,W];

      [B,B,B,J]
[K,K,W,W,K,E,K,W,W,K,K]

Feel free to try and test your code with any setup of walls, not just the ones in the test cases.

Test Cases:
V: [M,M,B,C,B,C,J,C,B,C,B,M,M]
S: [F,F,W,K,W,K,E,K,W,K,W,F,F]
O: Viking victory.
------------------------------
V: [M,M,M,M,M,M,M,M,M,M]
S: [W,W,W,W,W,W,W,W,W,W]
O: Saxon victory.
------------------------------
V: [B,C,M,B,C,M,M,C,B,M,C,B,M]
S:   [W,F,W,F,E,E,E,F,W,F,W]
O: Viking victory.
------------------------------
V:         [B,B,B,J,B,B,B]
S: [W,W,W,W,K,K,K,E,K,K,K,W,W,W,W]
O: Saxon victory.
------------------------------
V: [J]
S: [E]
O: Viking victory.
------------------------------
V: [C,C,C,C,B,B,M,M,M,M,J,J,J,M,M,M,M,B,B,C,C,C,C]
S: [K,K,K,K,K,K,K,K,K,K,W,E,W,K,K,K,K,K,K,K,K,K,K]
O: Saxon victory.
------------------------------
V: [M,M,S,C,B,J,B,C,S,M,M]
S: [F,K,P,W,K,E,K,W,P,K,F]
O: Saxon victory.
------------------------------
V: [S,S,S,...,S]
S: [P,P,P,...,P]
O: UNDEFINED (since both priests and skalds deal no damage, you can output anything here.)
------------------------------

There are some historical inaccuracies. Feel free to point them out and I'll do my best to fix them.

Link to the Sandbox

Can we define other symbols instead of the first letters of the names, for example numbers 0-9?

@NieDzejkob sure thing. Just make sure you specify in your answer which symbols were used for which warrior.

Would it be considered cheating to take input as their properties rather than letters? (example as (health, damage, damagebonus, protbonus))

@HyperNeutrino I'm not exactly sure, but I think it'd be okay? I don't see how that could give you a major advantage. As I told NieDzejkob, as long as you specify in your answer what's representing each warrior, go for it.

Does S give bonus to M or all nordic people?

@HyperNeutrino Skalds give their bonuses to any warrior next to them (up to +1 damage), not just to the Free Men.

When exactly is the array of dead warriors collapsed?

@TFeld If an array has dead warriors, you should remove them before the next round is computed.

@DLosc Thanks for the information, I'll update the question accordingly :)

@J.Sallé That's what i thought, but I don't get the same result as you in the test case (round 2->3):
V:[6,6,6,2,0,6,13,6,0,2,6,6,6], S:[3,3,3,2,2,6,16,6,2,2,3,3,3], gets collapsed to:
V: [6,6,6,2,6,13,6,2,6,6,6], S:[3,3,3,2,2,6,16,6,2,2,3,3,3], which in the next round is:
V: [4,5,4,0,4,12,4,0,4,5,4], S:[3,2,2,1,0,4,14,4,0,1,2,2,3]. But you get
V: [4,5,5,0,4,12,4,0,5,5,4], S:[2,2,2,1,0,4,14,4,0,1,2,2,2]

@TFeld you're right, I missed 1 damage there. Luckily the result won't change. Thanks for catching that, I'll edit it.

@J.Sallé What about testcase 3 (V: [B,C,M,B,C,M,M,C,B,M,C,B,M] S:   [W,F,W,F,E,E,E,F,W,F,W]) In my program the saxon line has an even number of warriors at step 3. How do I align it then?

@TFeld I actually forgot to add that case to the rules because I lost my earlier draft of the question which already had it in there hahahah. I edited that in, please check the rules section again :)

@J.Sallé "assigns damage to the warrior directly in front of it or, if there's no living warrior in front of it, the diagonally adjacent living warrior with least health remaining" - can there ever be more than 1 diagonally adjacent, given arrays are collapsed before each round?

@ngn I don't think so. I added that line "for safety" you might say, because I couldn't know for sure there wouldn't be a case where that didn't happen.

@J.Sallé "[A skald] gives each adjacent warrior 1 bonus damage. Skalds deal no damage." - what if two skalds are adjacent?

@ngn as you can see from the last test case, they’ll deal no damage even if there’s two skalds adjacent to one another.

@J.Sallé Thanks. I noticed that but I thought the priests on the opposite side might be protecting each other - "warrior" is ambiguous in the Saxon camp and I'm still not sure how to interpret priests. I'll have a closer look at the Python solution.

@J.Sallé In the example the transition from round 4 to round 5 seems wrong - if (as you said) dead warriors are removed before the round is computed, then the Free Men at the two ends should survive, not the Fyrds. Or am I missing something?

@ngn sorry for the late answer. The dead are removed before the next round is computed, yes, and you're right. Doing those by hand is quite weird, hahahah. I've fixed it now, fortunately it didn't affect the outcome.

Python 2, 576 573 565 554 540 549 bytes
O=[(0,0)]
g=lambda D,W,i:D[i-1]*(W[i-1]<1)+D[i]+D[i+1]*(W[i+1]<1)
h=lambda*V:[v for v in zip(*V)if v[1]>0]
def f(v,s):
 l,L=len(v),len(s);m=max(l,L);a,b=(L-l)/2,(l-L)/2;V,U=zip(*O+O*a+v+O*a+O+O);S,T=zip(*O+O*b+s+O*b+O+O);z=[0]*(m+2);w=z[:];r=range(1,m+1);U=list(U);T=list(T)
 for i in r:w[i]=[0,2,3,2,1,0][V[i]]+(5in V[i-1:i+2:2])*(V[i]<5);z[i]=[0,1,2,2+({1,2}&set(S[i-1:i+2:2])>set()),1,0][S[i]]
 for i in r:U[i]-=g(z,V,i);d=g(w,S,i);T[i]-=d-(d>0)*(5in S[i-1:i+2:2])
 V=h(V,U);S=h(S,T)
 if([],[])<(V,S)!=(v,s):return(f(V,S)if S else'V')if V else'S'

Try it online!

If I understand correctly, this bit: (5in V[i-1:i+2:2]) implies that adjacent skalds can inflict damage. You may need a ...*(V[i]!=5) there. Test: print f([S,S],[P]) # says V but should be a Draw

@ngn Thanks for that :)

APL (Dyalog Classic), 128 bytes
{t l d b p←(-⌊2÷⍨+/0=⊃⍵)∘⌽¨⍵⋄l+←e+3+/0,0,⍨(0=t)×e←(×≢¨p∩¨h)-⊖d+×≢¨b∩¨h←3,/0,t,0⋄⍵≡a←↑¨(⊂↓l>0)/¨¨↓¨t l d b p:0⋄0∊s←+/l>0:×-/s⋄∇a}

Try it online!
There are two functions in the TIO link: g is the golfed function above and f is an ungolfed function that accepts a pair of strings, converts them to a suitable representation and calls the golfed function.
The input is five matrices: t warrior types as ints; l life; d damage; b what warrior types give bonus when adjacent; p same for protection. The matrices consist of two rows - Vikings and Saxons. If their warriors are not the same number, the matrices must be 0-padded, though not necessarily centred. The result is 1/¯1 for Viking/Saxon victory or 0 for a draw.
{
  t l d b p←(-⌊2÷⍨+/0=⊃⍵)∘⌽¨⍵ ⍝ centre the matrices
  ⍝ (-⌊2÷⍨+/0=⊃⍵) is a pair of numbers - by how much we should rotate (⌽) the rows
  ⍝       +/0=⊃⍵  how many dead? (⊃⍵ is the types, dead warriors have type 0)
  ⍝  -⌊2÷⍨        negated floor of half

  l+←e+3+/0,0,⍨(0=t)×e←(×≢¨p∩¨h)-⊖d+×≢¨b∩¨h←3,/0,t,0 ⍝ compute and apply effective damage
  ⍝ h←3,/0,t,0  are triples of types - self and the two neighbours
  ⍝ b∩¨h        for each warrior intersect (∩) h with his bonus-giving set b
  ⍝ ×≢¨         non-empty? 0 or 1
  ⍝ d+          add to the damage normally inflicted
  ⍝ ⊖           reverse vertically (harm the enemy, not self)
  ⍝ (×≢¨p∩¨h)   same technique for protections (neighbouring priests)
  ⍝ e←          remember as "e" for "effective damage"; we still need to do the diagonal attacks
  ⍝ (0=t)×      zero out the attacks on living warriors
  ⍝ 3+/0,0,⍨    sum triples - each warrior suffers the damage intended for his dead neigbours
  ⍝ e+          add that to the effective damage
  ⍝ l+←         decrease life ("e" is actually negative)

  ⍵≡a←↑¨(⊂↓l>0)/¨¨↓¨t l d b p:0 ⍝ remove dead; if no data changed, it's a draw
  ⍝ ↓¨          split each matrix into two row-vectors
  ⍝ (⊂↓l>0)     boolean mask of warrios with any life left, split in two and enclosed
  ⍝ /¨¨         keep only the survivors
  ⍝ ↑¨          mix the pairs of rows into matrices again, implicitly padding with 0-s
  ⍝ a←          call that "a" - our new arguments
  ⍝ ⍵≡a ... :0  is "a" the same as our original arguments? - nothing's changed, it's a draw

  0∊s←+/l>0:×-/s ⍝ if one team has no members left, they lost
  ⍝ l>0         bitmask of survivors
  ⍝ s←+/l>0     how many in each camp
  ⍝ 0∊          has any of the two armies been annihilated?
  ⍝ :×-/s       if yes, which one? return sign of the difference: ¯1 or 1, or maybe 0

  ∇a ⍝ repeat
}


text:
Trying to optimize a solution to a puzzle with PHP
I got inspired by this: Print every character your program doesn't have
But with the exception that the letters have to be between ASCII 32 to 126. We started fooling around with it at the office with PHP and this is the best we could come up with:
<? while($i++<95)if(!strstr(file(__FILE__)[0],$a=chr($i+31)))echo$a;
Is it possible to make it even shorter with PHP?

For those who have voted to close this as off-topic: [tag:tips] questions with an objective winning criterion (such as [tag:code-golf]) are not off-topic.

I'm voting to close this as unclear, because at PPCG we have specific rules and banned loopholes for quine-style challenges, including reading your own source code as your snippet does, but we don't know what would be kosher for you and your office buddies.

Also, I think this question would benefit from more explanation and context, as is usual on Stack Exchange. What is the code doing, and what golfing ideas have you used? What alternatives have you or others tried? What parts do you suspect could be shorter? In general, I think questions that just say "I have a task and a piece of code, how can it be shorter?" are closer to single-languages golf challenges than tips questions?


text:
Digitangular numbers
A triangular number is a number that can be expressed as the sum of consecutive positive integers, starting at 1. They can also be expressed with the formula n(n + 1) / 2, where n is some positive integer.
A number's digitangular counterpart is calculated in the following way:

Split a number into an array of its digits e.g. 613 => [6 1 3]
For each number in the array, calculate the nth triangular number; [6 1 3] => [21 1 6]
Sum the resultant array; [21 1 6] => 28

Your task is, given an integer n, repeatedly calculate n's digitangular counterpart, until the result is equal to 1, then output all values that were calculated. You may output the values in any order, and with an optional inclusion of the original number at the start of the array. This is a code-golf so the shortest code wins.
Test cases
23 => 9 45 25 18 37 34 16 22 6 21 4 10 1
72 => 31 7 28 39 51 16 22 6 21 4 10 1
55 => 30 6 21 4 10 1
78 => 64 31 7 28 39 51 16 22 6 21 4 10 1
613 => 28 39 51 16 22 6 21 4 10 1
8392 => 90 45 25 18 37 34 16 22 6 21 4 10 1
11111 => 5 15 16 22 6 21 4 10 1
8592025 => 117 30 6 21 4 10 1
999999999 => 405 25 18 37 34 16 22 6 21 4 10 1

May we include the original number as first in the resultant array?

How do we know it always goes down to 1?

@SimplyBeautifulArt Well, I've tested every integer from 1 to 10000, and all have reached the same pattern that eventually leads to 1. I can't be bothered to write a proof, but if you can find an integer that doesn't, tell me and I'll edit that into the question.

Let's suppose that a number is larger than 141 and has n digits. The maximum value its digitangular counterpart can have is 45n, so digi-△(x) ≤ 45n < 45(1+log_10(x)), and for x > 141, we have 45(1+log_10(x)) < x, hence digi-△(x) ≤ x-1 for x > 141, and once we pass the 141 limit, well, we brute force prove via programs.

@SimplyBeautifulArt Shouldn't it be stated that digi-△(x) ≤ 45n ≤ 45(1+log_10(x)) since 45n = 45(1+log_10(x)) for any n-digit number x > 141 that is a power of 10?

Oh, you're right. A tad too late to edit + it happily doesn't affect my analysis of this sequence.

@R.Kap Also, we could more nicely write n = ⌊1+log10(x)⌋, for any x.

Interestingly, it seems as if the sequence always ends with 6 21 4 10 1. I don't know how to rigorously prove this for all the natural numbers though.

I have 13 bytes in Jelly - Outgolfed :^)

@Mr.Xcoder As usual, I overthought it :P

The wording of the question implies that we can't start output until after the calculation is completed.  Is that intentional?  Or should "then" be merely "and"?

Can I have trailing 1's at the end of my output?

@R.Kap Trivially, it won't. Consider 1en, 4en, or 6en for any natural n. (really bad scientific notation)

Related: Digitangular numbers, seeking alternative proofs that this sequence goes to 1 eventually.

@SimplyBeautifulArt Huh, that's pretty cool. That's two of my challenges where people are seeking proof that they work for given numbers

@TobySpeight You may output at any point of the execution of the program, be that at the start (somehow), the middle or the end

@SimplyBeautifulArt As in more than a single one? If so, then no, as your program doesn't terminate when it reaches one.

Husk, 6 bytes
U¡(ṁΣd

Try it online!
Explanation
U¡(ṁΣd
 ¡(       Iterate the following function on the input:
     d       Split the number into digits
   ṁΣ        Map each digit to its triangular number, then sum the results
U         Take the results of iteration until before the first repeated one

05AB1E, 6 5 bytes
Δ=SLO

Try it online! Edit: Saved 1 byte thanks to @Emigna. Explanation:
Δ       Repeat until value doesn't change
 =      Print current value
  S     Split into characters
   L    Turn each character into range from 1 to N
    O   Sum

If you replace € with S, you can skip one O.

@Emigna ...why does L even behave that way?

If I recall correctly it was a bug that turned out to be useful and got to remain as a feature. I think it was one the first methods that vectorized.

APL (Dyalog), 23 20 17 bytes
3 bytes saved thanks to @ngn
{⍵∪⍨+/∊⍳¨⍎¨⍕⊃⍵}⍣≡

Try it online!
How?
⍵∪⍨ - prepend current array to the
+/ - sum of
∊ - flattened
⍳¨ - ranges of each
⍎¨⍕ - digit of the
⊃⍵ - previous value
⍣≡ until convergence. The usage of ∪ (union) makes sure after the first 1 is joined, the next will be excluded due to set uniqueness, and the array will converge.

Out of curiosity, how long would it be if you weren't allowed to output the original value as well?

@cairdcoinheringaahing 2 bytes - 1↓ (drop first)

@Uriel Here power limit (⍣≡) gives a shorter solution than recursion: {⍵∪⍨+/∊⍳¨⍎¨⍕⊃⍵}⍣≡ but it's a shame APL doesn't have a concise way to collect all iterations of a function until convergence: ⍵(f⍵)(f⍣2⊢⍵)(f⍣3⊢⍵)...

@ngn thanks! I did try to use the power operator, but I didn't think about the fact it converges after 1. Will update soon

@ngn any idea on how to use {+/∊⍳¨⍎¨⍕⎕←⍵}⍣≡ without getting the last 1 printed?

@Uriel append ~1 ?

@ngn that would remove them both.

...I don't see any ∇ there?

@EriktheOutgolfer residue from previous, fixed, thanks

@Uriel both? I see just one. By the way, if you prefer to have the result in the same order as in the problem description, this is the same number of bytes: {⍵∪+/∊⍳¨⍎¨⍕⊃⌽⍵}⍣≡

J, 20 19 bytes
(1#.2!1+,.&.":)^:a:

Try it online!
Outputs the original number, too.
Explanation
(1#.2!1+,.&.":)^:a:
               ^:a:  Apply until input converges, storing all results in an array
(1#.2!1+,.&.":)      Digitangular sum
        ,.&.":         Split to digits
          &.":           Convert to string, apply left function, then undo conversion
        ,.               Ravel items (make array of singleton arrays of items)
                         This ensures that when cast back to integers, the digits are split.
      1+               Add 1 to each
    2!                 Compute (n choose 2) on each (nth triangular number)
 1#.                   Sum (debase 1)

[:+/ ->1#. meow!

@FrownyFrog not an original trick, though I certainly make ample use of it when I remember to.

Haskell, 51 47 46 bytes
f 1=[1]
f x=x:f(sum$do d<-show x;[1..read[d]])

Try it online!
f 1=[1]                     -- if x == 1, return the singleton list [1]
f x=                        -- else
         do d<-show x       --  for each char 'd' in the string representation of x
                            --    (using the list monad)
           [1..read[d]]     --  make a list of [1..d]
                            --    (the list monad concatenates all those lists into a single list)
        sum                 --  sum those numbers
      f                     --  call f on it
    x:                      --  and put x in front of it

Edit: @H.PWiz saved a byte. Thanks!

Python 2, 62 bytes
f=lambda x:x<2and[1]or[x]+f(sum(-~int(i)*int(i)/2for i in`x`))

Try it online!

Wolfram Language (Mathematica), 43 41 bytes
Echo@#>1&&#0[#.(#+1)/2&@IntegerDigits@#]&

Try it online!
How it works
The expression #.(#+1)/2&@IntegerDigits@# gives the digitangular counterpart of #. We Echo the input, use short-circuit evaluation with && to stop if we've reached 1, and otherwise recurse on the digitangular counterpart.

-2 bytes thanks to Martin Ender for the . trick: we don't have to use Tr to sum the digits if we replace the multiplication #(#+1)/2 by the dot product #.(#+1)/2.

Only just saw your answer now. You can beat mine by using the scalar product trick to avoid the Tr: Echo@#>1&&#0[#.(#+1)/2&@IntegerDigits@#]&

@MartinEnder Thanks, that's a neat trick. I wonder if there any even golfier ways to do "print all iterations of this function on the way to a fixed point" (essentially, reimplementing FixedPointList except for how that prints the fixed point twice). It seems like that should have come up before.

Wolfram Language (Mathematica), 49 42 39 bytes
Thanks to Misha Lavrov for saving 3 bytes.
#//.x_:>(y=IntegerDigits@Echo@x).++y/2&

Try it online! (TIO needs parentheses around the ++y for some reason. In my local Mathematica installation it works without them, as it should.)
Prints each value on its own line, preceded by >>, and includes the starting number.

You can go back to beating my answer with #//.x_:>(y=IntegerDigits@Echo@x).++y/2&. (...maybe. For some reason, TIO doesn't like this, but Mathematica's fine with it?)

Well, #//.x_:>(y=IntegerDigits@Echo@x).(++y)/2& is 41 bytes and works in TIO. But my copy of Mathematica doesn't think the parentheses are necessary.

@MishaLavrov Thanks. Yeah, no clue why TIO needs the parentheses, but syntax in script files is sometimes a bit wonky.

Ruby, 60 47 42 bytes
-13 bytes by @JustinMariner
-5 bytes by @GB
->x{p x=x.digits.sum{|k|k*-~k/2}while x>1}

Try it online!

You can drop the array and splat ([*...]) and change (k+1) to -~k to save a total of 5 bytes: Try it online!  Additionally, you can save 8 more by switching to an anonymous lambda function: Try it online!

Hm, no idea why I thought .map couldn't take arrays.

You can use "sum{...}" instead of "map{...}.sum" and then remove the space before "while"

Japt, 19 17 10 bytes
Doesn't include the input as the first element.
Æ=ì cò xÃâ

Try it
Æ=ì cò xÃâ     :Implicit input of integer U
Æ              :Map the range [0,U)
 =             :  Reassign to U
  ì            :  Convert to digit array
    c          :  Flat map
     ò         :    Range [0,digit]
       x       :  Reduce by addition
        Ã      :End map
         â     :Deduplicate

Retina, 21 bytes
;{:G`
.
$*1¶
1
$%`1
1

Try it online! (The outputs of the individual cases aren't well separated, but each output ends with a 1.)
Prints each number on its own line, in order, including the starting number.
Explanation
;{:G`

This is just some configuration of the program. { makes the program loop until it fails to change the result (which happens once we get to 1), : prints number before each iteration, and ; prevents the final result from being printed twice at the end of the program. The G is just my usual way of creating a no-op stage.
.
$*1¶

Convert each digit to unary and put it on its own line.
1
$%`1

Compute the triangular number on each line, by replacing each 1 with its prefix. We could also use M!&`1+ here, which gives us all suffixes of each line.
1

Count all 1s, which sums up all the triangular numbers and converts the result back to decimal.

Is Retina a turing complete language?

@ThePirateBay yes.

Ohm v2,  9  7 bytes
·Ω}#ΣΣu

Try it online!
Explanation
          Implicit input as a string
·Ω        Evaluate until the result has already been seen, pushing intermediate results
  }       Split digits
   #      Range from 0 to N
    ΣΣ    Sum
      u   Convert to string

Isn't u unnecessary?

It's necessary otherwise } won't split the digits

Hm. That might be a bug. I'll check it out.

Befunge-93, 51 bytes
p&>>:25*%:1+*2/v
  |:/*52p00+g00<
00<vp000_@#-1.::g

Try it online!
James Holderness cleverly reshaped my progarm into a 51-byte form. Thanks!

Pushy, 24 22 21 17 bytes
[sL:R{;Svc^#&1=?i

Try it online!
Explanation
[sL:R{;Svc^#&1=?i

[           &1=?i   \ Loop until result == 1:
 s                  \   Split last result into digits
  L:  ;             \   For each digit n:
    R{              \       Push the range (1, n) inclusive
       S            \   Sum the ranges
        vc^         \   Delete all stack items, except the sum
           #        \   Print result

R, 70 bytes
f=function(n)"if"(n-1,c(n,f((d=n%/%10^(nchar(n):0)%%10)%*%(d+1)/2)),n)

Try it online!
Returns the original value as well.
R, 80 bytes
function(n){o={}
while(n-1){n=(d=n%/%10^(nchar(n):0)%%10)%*%(d+1)/2
o=c(o,n)}
o}

Try it online!
Does not return the original value.

Lua, 91 bytes
function f(n)x=0 for d in((0|n)..""):gmatch"."do x=x+d*(d+1)/2 end print(x)c=x==1or f(x)end

Try it online!

05AB1E, 20 12 bytes
Saved 2 bytes thanks to caird coinheringaahing
ΔD,þ€iLO}O}}

Try it online!
Explanation
(old version)
Δþ€iD>*;}OD1›iD,}}1,  Main program
Δ                }    Repeat until there is no changes
 þ                    Push digits of the input number
  €i    }             Apply for each digit
    D>*;              Calculate the triangular number for given digit
         O            Sum all numbers
          D1›iD,}     Print if greater than 1
                  1,  Print 1 at the end

JavaScript, 61 57 bytes
f=a=>a-1?([...a+[]].map(b=>a+=b++*b/2,a=0),a)+' '+f(a):''

Try it online!

Python 2, 69 bytes
def f(x):
 while x>1:
  x=sum(-~int(z)*int(z)/2for z in`x`)
  print x

Try it online!

64

k, 19 bytes
{+/(+/1+!"I"$)'$x}\

Unsurprisingly works similarly to the already posted APL and J solutions
               $x    cast x (implicit var of lambda) to string
   (         )'      apply composition (function train) to each character of string
    +/1+!"I"$        cast character to number, create list from 1 to n, sum it
 +/                  sum triangular numbers
{                }\  iterate lambda until result converges, appending each result

Charcoal, 18 bytes
Ｗ⊖Ｉθ«≔ＩΣ⭆θΣ…·0κθθ⸿

Try it online! Link is to verbose version of code. Explanation:
   θ                Input
  Ｉ                 Cast to integer
 ⊖                  Decrement
Ｗ   «               Loop while not zero
         θ          Current value
        ⭆           Map over characters and concatenate
             0      Literal character 0
              κ     Current character
           …·       Inclusive range
          Σ         Concatenate
       Σ            Sum of digits
      Ｉ             Cast to string
     ≔         θ    Assign back to value
                θ   Output latest value
                 ⸿  Move to start of next line

dc, 62 bytes
?sj[0soljZ1-[dljr10r^/10%d1+*2/lo+sod1-r0<i]dsixlopdsj1<b]dsbx

Try it online!

C, 72 bytes
s;F(n){for(s=0;n;n/=10)for(;n%10;n--)s+=n%10;printf("%d ",s);s<2?:F(s);}

Try it online!

D, 140 bytes
import std.algorithm,std.range,std.conv,std.stdio;void f(T)(T n){n=n.text.map!(u=>u.to!T-48+(u.to!T-48).iota.sum).sum;n.writeln;if(n-1)n.f;}

Try it online!

PHP, 71+1 bytes
for(;1<$n="$s"?:$argn;print$s._)for($i=$s=0;$p--||~$p=$n[$i++];)$s+=$p;

Run as pipe with -nR or try it online. (requires PHP 5.3 or later for the Elvis operator)

What's the Elvis operator?

@cairdcoinheringaahing A?:B: if A is truthy then A else B

Jelly, 7 bytes
DRFSµÐĿ

Try it online!

DRFSµÐĿ: Full program / monadic link.
ÐĿ: Loop until results are no longer unique (if something other than 1 would occur twice, then the given input does not have a defined result, since it would never reach 1).
D: Convert from integer to decimal.
R: Range (1-indexed). Vectorizes.
F: Flatten and S: Sum (µ just creates a new monadic chain)

dc, 31 bytes
[[I~d1+*2/rd0<m+]dsmxpd1<f]dsfx

The function m computes the digitangular function of its input; f repeats this until the result reaches 1.
Note that we use the input radix to extract digits - this means it will work in any base system, not only decimal.
Demo

for i in 23 72 55 78 613 8392 11111 8592025 999999999
    do echo $i '=>' $(dc -e $i'[[I~d1+*2/rd0<m+]dsmxpd1<f]dsfx')
done

23 => 9 45 25 18 37 34 16 22 6 21 4 10 1
72 => 31 7 28 39 51 16 22 6 21 4 10 1
55 => 30 6 21 4 10 1
78 => 64 31 7 28 39 51 16 22 6 21 4 10 1
613 => 28 39 51 16 22 6 21 4 10 1
8392 => 90 45 25 18 37 34 16 22 6 21 4 10 1
11111 => 5 15 16 22 6 21 4 10 1
8592025 => 117 30 6 21 4 10 1
999999999 => 405 25 18 37 34 16 22 6 21 4 10 1

Python 2, 76 bytes
f=lambda k,s=0:k+s<2and[1]or[k]*(s<1)+f(*[k/10,s,s+k%10*(k%10+1)/2][k<1::2])

Try it online!

Neim, 8 bytes
ͻtD÷D

Explanation:
ͻ             Start infinite loop
             Split top of stack into each of its characters
  t           Push infinite list of triangular numbers
             For each of the characters, get the nth element in the above list.
              Sum.
     D         Duplicate.
      ÷        If top of stack is equal to 1, break.
       D       Duplicate.
               Implicitly print all elements in the stack, concatenated.

Try it online!
Formatted output

Add++, 32 bytes
D,f,@,EDBFEREss
+?
y:1
W!,$f>x,O

Try it online!
Doesn't output the first value
How it works
D,f,@,   - Create a monadic function, f.
         - Example argument: [613]
      ED - Digits;   STACK = [[6 1 3]]
      BF - Flatten;  STACK = [6 1 3]
      ER - Range;    STACK = [[1 2 3 4 5 6] [1] [1 2 3]]
      Es - Sum each; STACK = [21 1 6]
      s  - Sum;      STACK = [28]

           f calculates n's digitangular counterpart

+?       - Take input;     x = 613; y = 0
y:1      - Set y to 1;     x = 613; y = 1
W!,      - While x != y...
   $f>x, -   Call f;       x =  28; y = 1
   O     -   Print x;

Perl 6, 36 bytes
{$_,{sum map {sum 1..$_},.comb}...1}

Try it online!
Includes the input number in the output list.

K (oK) / K4, 17 bytes
Solution:
{+/,/!:'1+.:'$x}\

Try it online!
Examples:
{+/,/!:'1+.:'$x}\23
23 9 45 25 18 37 34 16 22 6 21 4 10 1
{+/,/!:'1+.:'$x}\72
72 31 7 28 39 51 16 22 6 21 4 10 1
{+/,/!:'1+.:'$x}\999999999
999999999 405 25 18 37 34 16 22 6 21 4 10 1

Explanation:
Converge over lambda returning all results along the way:
{+/,/!:'1+.:'$x}\ / the solution
{              }\ / lambda {}, converge \
             $x   / string input, 613 => "613"
          .:'     / value (.:) each (') "613" => 6 1 3
        1+        / add 1, 6 1 3 => 7 1 4
     !:'          / til (!:) each (') to generate ranges
   ,/             / flatten list
 +/               / sum list

Pyt, 17 bytes
`Đą△ƩĐ1≠?ŕł:;ŕ↔ŕ↔

Explanation:
                        Implicit input
`         ł             Loop ... while top of stack is not zero
 Đ                      Duplicate the top of the stack
  ą△Ʃ                   Get the digitangular sum of the top of the stack
     Đ1≠                Is it not equal to 1?
        ?  :;           If top of stack is 1, Then continue; Else jump to ':'
         ŕ              Remove top of stack
          ł             Loop back to ` if top of stack is 1
           :;           If top of stack isn't 1, then continue from ':'
             ŕ↔ŕ↔       Remove top and bottom of stack
                        Implicit print

Try it online!