text:
Is this quadrilateral cyclic?
In mathematics, a cyclic quadrilateral is one whose vertices all lie on the same circle. In other words, every vertex is on the circumcircle of the other three. For more information, see the MathWorld article.
Examples
These quadrilaterals are cyclic:

This trapezoid is not cyclic.

(Images from Wikipedia)
Objective
Given the coordinates of four vertices in counterclockwise order which form a convex quadrilateral, determine if the quadrilateral is cyclic.
Coordinates will be integers (note, however, that the circumcenter coordinates and circumradius are not necessarily integers.) As implied by the previous paragraph, no three points will be co-linear and no two coincident.
I/O
You may take input using any reasonable format. In particular, [[x1,x2,x3,x4],[y1,y2,y3,y4]], [[x1,y1],[x2,y2],[x3,y3],[x4,y4]] and complex numbers are all fine.
Output using any different consistent values for true and false.
Test cases
True:
[0,0], [314,0], [314,1], [0,1]
[-5,5], [5,-5], [1337,42], [42,1337]
[104, -233], [109, -232], [112, -231], [123, -224]

False:
[0,0], [314,0], [314,100], [0,99]
[31,41],[59,26],[53,58],[0,314]

Wolfram Language (Mathematica), 23 bytes
#∈Circumsphere@{##2}&

Try it online!
Takes four inputs: the lists {x1,y1}, {x2,y2}, {x3,y3}, and {x4,y4}. Checks if the first point lies on the circumcircle of the other three. Also works for checking if \$n+1\$ points in \$\mathbb R^n\$ are concyclic, provided the last \$n\$ of them are affinely independent (because Circumsphere is sad if you give it a degenerate input).
Alternatively, here is a mathematical approach:
Wolfram Language (Mathematica), 29 28 25 24 bytes
Det@{#^2+#2^2,##,1^#}^0&

Try it online!
Takes two lists as input: {x1,x2,x3,x4} and {y1,y2,y3,y4}. Returns Indeterminate when the four points are on a common circle, and 1 otherwise.
From the four points \$(x_1, y_1), (x_2,y_2), (x_3, y_3), (x_4, y_4)\$, this solution constructs the matrix below:
\$\begin{bmatrix}x_1^2 + y_1^2 & x_2^2 + y_2^2 & x_3^2 + y_3^2 & x_4^2 + y_4^2 \\ x_1 & x_2 & x_3 & x_4 \\ y_1 & y_2 & y_3 & y_4 \\ 1 & 1 & 1 & 1 \end{bmatrix}\$
The determinant of this matrix is 0 if and only if the four rows are linearly dependent, and a linear dependency between the rows is the same thing as the equation of a circle that's satisfied at all four points.
The shortest way I could think of to check if the determinant is 0 is to raise it to the 0-th power: 0^0 is Indeterminate while anything else gives 1.

Python 3, 70 bytes
lambda b,c,d,e,a=abs:a(a(b-d)*a(c-e)-a(b-c)*a(d-e)-a(c-d)*a(b-e))<1e-8

Try it online!
I use the Ptolemy's theorem.

In a quadrilateral, if the sum of the products of its two pairs of
  opposite sides is equal to the product of its diagonals, then the
  quadrilateral can be inscribed in a circle.

b, c, d, e are complex numbers.

Perl 6, 44 bytes
{!im ($^b-$^a)*($^d-$^c)/(($d-$a)*($b-$c)):}

Try it online!
Takes vertices as complex numbers. Uses the fact that the sum of opposite angles is 180° in a cyclic quadrilateral. The order of operations should guarantee that floating-point operations yield an exact result for (small enough) integers.
Port of Misha Lavrov's TI-Basic solution, 33 bytes
{![*](map */*,($_ Z-.rotate)).im}

Try it online!

42? Is it still accurate?

@JoKing No, it's not.

What does the colon do in this case? It's definitely not a label, and also not a method call.

@user202729 It is a method call with indirect invocant syntax.

JavaScript (ES6)
Testing the angles, 114 bytes
Takes input as the array \$[x1,y1,x2,y2,x3,y3,x4,y4]\$. Returns a Boolean value.
a=>(F=i=>(A=Math.atan2)(a[i+3&7]-(y=a[i+1]),a[i+2&7]-a[i])-A(a[i+5&7]-y,a[i+4&7]-a[i]))(0)+F(2)+F(4)+F(6)==Math.PI

Try it online!

Computing a determinant, 130 bytes
Takes input as \$[x1,x2,x3,x4]\$ and \$[y1,y2,y3,y4]\$ in currying syntax. Returns a Boolean value.
This one is equivalent to MishaLavrov's 2nd answer, with a rotated matrix.
x=>y=>!(g=a=>a+a?a.reduce((v,[r],i)=>v+(i&1?-r:r)*g(a.map(r=>r.slice(1)).filter(_=>i--)),0):1)(x.map((X,i)=>[1,Y=y[i],X,X*X+Y*Y]))

Try it online!

TI-Basic (83 series), 21 bytes
e^(ΔList(ln(ΔList(augment(Ans,Ans
not(imag(Ans(1)Ans(3

Takes input as a list of four complex numbers in Ans. Returns 1 if the quadrilateral is cyclic and 0 otherwise.
This is nwellnhof's cross-ratio computation, in heavy disguise. If we start with values \$z_1, z_2, z_3, z_4\$, then:

ΔList(augment(Ans,Ans computes the differences \$z_2-z_1, z_3-z_2, z_4-z_3, z_1-z_4\$ (and a few more redundant terms),
e^(ΔList(ln( of that computes the ratios \$\frac{z_3-z_2}{z_2-z_1}, \frac{z_4-z_3}{z_3-z_2}, \frac{z_1-z_4}{z_4-z_3}, \dots\$.
We check if the product of the first and third terms, which is \$\frac{z_3-z_2}{z_2-z_1} \cdot \frac{z_1-z_4}{z_4-z_3}\$, has no imaginary part. Note that this is the same as the cross-ratio \$(z_3,z_1;z_2,z_4) = \frac{z_2-z_3}{z_2-z_1} : \frac{z_4-z_3}{z_4-z_1}\$.

I did my best to check if numerical error is a problem, and it doesn't seem to be, but if anyone has good test cases for that, please let me know.

JavaScript (ES6) (101 bytes)
p=>(h=(a,b)=>Math.hypot(p[a]-p[b],p[a+1]-p[b+1]))&&((h(2,4)*h(0,6)+h(0,2)*h(4,6)-h(0,4)*h(2,6))<1e-8)

Takes input as [x1,y1,x2,y2,x3,y3,x4,y4], outputs a Boolean.
Checked based on $$ef=ac+bd$$ where \$e,f\$ are the diagonals and \$a,b,c,d\$ are the sides in order.
Try it online!

Jelly, 11 bytes
²Sṭ;L€€ṖÆḊ¬

Try it online!
Uses the determinant approach from Misha Lavrov's Mathematica solution. Outputs 1 for true, 0 for false.
How it works
²Sṭ;L€€ṖÆḊ¬  Main link (monad). Input: [[x1,x2,x3,x4], [y1,y2,y3,y4]]
²S           Square each scalar and add row-wise; [x1*x1+y1*y1, ...]
  ṭ          Append to the input
   ;L€€      Add two rows of [1,1,1,1]'s
       Ṗ     Remove an extra row
        ÆḊ¬  Is the determinant zero?

Jelly, 12 bytes
Iµ÷×ƭ/÷SµḞ=A

Try it online!
Uses the convoluted cross-ratio approach from Misha Lavrov's TI-Basic solution. Outputs 1 for true, 0 for false.
How it works
Iµ÷×ƭ/÷SµḞ=A  Main link (monad). Input: list of four complex numbers [z1,z2,z3,z4]
I             Increments; [z2-z1, z3-z2, z4-z3]
 µ            Refocus on above for sum function
  ÷×ƭ/÷S      (z2-z1)÷(z3-z2)×(z4-z3)÷(z4-z1)
        µ     Refocus again
         Ḟ=A  (real part) == (norm) within error margin
              i.e. imag part is negligible?

I believe both are golfable...

APL (Dyalog Classic), 25 bytes
{0=-/|⍵}(-⌿2 3⍴2/⌽)×⊃-1↓⊢

Try it online!
Ptolemy's theorem, credit: Кирилл Малышев's answer


text:
Dyadic Transpose
As with most APL symbols, ⍉ has different meanings when called with one argument (transpose) versus two arguments (dyadic transpose / reorder dimensions). This challenge concerns the latter, which acts similarly to numpy.moveaxis in Python or permute in MATLAB, but is more powerful.
order ⍉ A when order has distinct entries
When all members of order are distinct, order ⍉ A is equivalent to:

numpy.moveaxis(A, tuple(range(len(A.shape)), order) in Python, or
permute(A,order) in MATLAB. Quoting from documentation of the latter:

B = permute(A,order) rearranges the dimensions of A so that they are in the order specified by the vector order. The resulting array B has the same values as A but the order of the subscripts needed to access any particular element is rearranged as specified by order.

For example, suppose A is a 3D array, and let B ← (2 0 1)⍉A. Then B is such that B[x0,x1,x2] = A[x2,x0,x1] for all x2,x0,x1
order ⍉ A when order has repeated entries
When order has repeated entries, we take a diagonal slice of the array. For example, let A be a 2x3x4 array. B ← (0 0 1)⍉A takes a diagonal slice along A to create B such that B[x0,x1] = A[x0,x0,x1]. Note that B is a 2x4 array: if it were 3x4, we would need to set B[2, x1] = A[2, 2, x1] which would be out of bounds of A. In general the kth dimension of B will be the minimum of all A.shape[i] such that order[i] = k.
Example
Consider the dyadic transpose order⍉A where order = [2, 1, 0] and A is 3x4x5
    A =
[[[ 0  1  2  3  4]
  [ 5  6  7  8  9]
  [10 11 12 13 14]
  [15 16 17 18 19]]

 [[20 21 22 23 24]
  [25 26 27 28 29]
  [30 31 32 33 34]
  [35 36 37 38 39]]

 [[40 41 42 43 44]
  [45 46 47 48 49]
  [50 51 52 53 54]
  [55 56 57 58 59]]]

The result is the 5x4x3 array B =
[[[ 0 20 40]
  [ 5 25 45]
  [10 30 50]
  [15 35 55]]

 [[ 1 21 41]
  [ 6 26 46]
  [11 31 51]
  [16 36 56]]

 [[ 2 22 42]
  [ 7 27 47]
  [12 32 52]
  [17 37 57]]

 [[ 3 23 43]
  [ 8 28 48]
  [13 33 53]
  [18 38 58]]

 [[ 4 24 44]
  [ 9 29 49]
  [14 34 54]
  [19 39 59]]]

Note that when, for example, (x0, x1, x2) = (4,1,2) we have B[x0,x1,x2] = A[x2, x1, x0] = A[2,1,4] = 49.
If instead order = [0, 0, 0] and A as above, then we would have the output B be the 1-dimensional size-3 array B = [0, 26, 52] so that B[1] = B[x0] = A[x0,x0,x0] = A[1,1,1] = 26
Input
Here we use 0-indexing, but you may also use 1-indexing as is the APL default.

A multidimensional or nested array A, of dimension n ≥ 1.

A list order of n positive integers consisting of the integers {0,1,...,k} (or {1,...,k+1} for 1-index) for some k < n, in any order, possibly with repetitions.

Output

A multidimensional or nested array representing the result of applying the dyadic transpose with those arguments. (The output will have dimension k+1.)

You may write a full program, function, etc. as allowed by the current standard on meta.
If your language has a builtin, it is encouraged to also write a solution without the builtin for the sake of an interesting answer.
Test cases
Test cases on TIO
Reference Python implementation coming soon.
Note for reading test cases: in APL, the penultimate and ultimate axes of an array are along columns and rows in that order.

APL, 1 byte: ⍉ :P

Actually, many APL symbols just use a default second argument when called with one argument. This includes ⍉ which uses the reversed axis indices as default, so ⍉A is the same as (2 1 0)⍉A if A is a 3-dimensional array and in general ⍉A is (⌽⍳≢⍴A)⍉A.

@lirtosiast question about i/o: can a multidimensional array be represented as a pair of shape (list of dimensions) and content (all elements in lexicographical order of their indices)?

@ngn I would say no for now, but you should ask on meta whether that format is acceptable by default.

@lirtosiast Anecdotally, Dyalog APL internally stores arrays as [number-of-dimensions,first-dimension-length,second-dimension-length,…,last-dimension-length,first-element,second-element,…,last-element].

APL (Dyalog Unicode), 34 bytesSBCS
This is my colleague's code (slightly modified from Roger Hui: A History of APL in 50 Functions, chapter 30), posted with explicit permission.
Anonymous tacit infix lambda (can be used as drop-in for ⍉).
{⍵[(⊂⊂⍺)⌷¨,¨⍳⍺[⍋⍺]{⌊/⍵}⌸(⍴⍵)[⍋⍺]]}

Try it online!
{…} dfn; ⍺ is left argument (axes), ⍵ is right argument (array)
E.g. [2,2,1] and [[[1,2],[3,4]]]
 ⍵[…] index the array with:
  (⍴⍵)[…] the shape (lengths of axes) of the array, indexed by:
  [1,2,2]
   ⍋⍺ the grading vector (the indices that would sort them) of the axes
   [3,1,2]
  [2,1,2]
  ⍺[⍋⍺]{…}⌸ use the sorted axes as keys to group that, and for each group:
  [1,2,2] → {"1":[2],"2":[1,2]}
   {⌊/⍵} find the lowest axis length
   {"1":2,"2":1} → [2,1]
  ⍳ generate the indices in a Cartesian system of those dimensions
  [[[1,1]],[[2,1]]]
  ,¨ ensure that the indices of each coordinate is a vector (would be scalar if ⍵ is a vector)
  [[[1,1]],[[2,1]]]
  (…)⌷¨ index into each of those with the following:
   ⊂⊂⍺ the axes (doubly enclosed; once for ⌷ to select those cells along the first and only axis, and once for ¨ to pair up each vector on the right with the entire set of axes on the left)
   2 1 2
  [[[1,1,1]],[[1,2,1]]]
 [[1],[3]]

source: Stack Exchange

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

sort: votes


text:
Drawing the Peano curve
Introduction
In geometry, the Peano curve is the first example of a space-filling curve to be discovered, by Giuseppe Peano in 1890. Peano's curve is a surjective, continuous function from the unit interval onto the unit square, however it is not injective. Peano was motivated by an earlier result of Georg Cantor that these two sets have the same cardinality. Because of this example, some authors use the phrase "Peano curve" to refer more generally to any space-filling curve.
Challenge
The program takes an input which is an integer n, and outputs a drawing representing the nth iteration of the Peano curve, starting from the sideways 2 shown in the leftmost part of this image:

Input
An integer n giving the iteration number of the Peano curve.
Optional, additional input is described in the bonuses section.
Output
A drawing of the nth iteration of the Peano curve. The drawing can be both ASCII art or a "real" drawing, whichever is easiest or shortest.
Rules

The input and output can be given in any convenient format (choose the most appropriate format for your language/solution).
No need to handle negative values or invalid input
Either a full program or a function are acceptable.
If possible, please include a link to an online testing environment so other people can try out your code!
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Bonuses
Since this shouldn't be a walk in the park (at least in most languages I can think of), bonus points are awarded for the following:

-100 bytes if your code generates a gif of the construction of the Peano curves up to n.
-100 bytes if your code draws a space-filling curve for any rectangular shape (the Peano curve only works for squares, obviously). You can assume that the input then takes on the form n l w where n has the same meaning as before (the number of the iteration), but where l and w become the length and width of the rectangle in which to draw the curve. If l == w, this becomes the regular Peano curve.

Negative scores are allowed (but are they possible...).
Edit
Please include the output of your program in the solution for n == 3 (l == w == 1).

Welcome to PPCG :) This, at a glance, looks like a nice first challenge. Although it feels familiar, I think the challenge I might be thinking of was an ASCII art one. Note, though, that we strongly discourage bonuses and that there will be golfing languages that can achieve this in less than 100 bytes. Also, and most importantly, you need a winning criterion. Given that your bonuses subtract bytes from a solution's score, I suspect you intend this to be [tag:code-golf].

I think you're probably confusing it with either a question about Hilbert curves, which are sort of an easier version of Peano curves, or one of the many questions about fractals, mainly the Koch snowflake and Sierpinski carpet. As for the bonuses, I seriously doubt that there would be golfing languages that can do this in less than 100 bytes... And my winning criterion is included, it's the last point in the "Rules" section :).

Have you seen golfing languages on this site? I’m willing to bet Canvas can do it in less than 50.

Oh, I could well be thinking of a challenge about a different (but maybe similar looking pattern), which is why I didn't VTC this as a dupe - that and my vote is a hammer, so I avoid using it unless I'm 100% sure a challenge is a dupe. And apologies for missing the winning criterion; my brain must have trained itself to gloss over the boilerplate rules section of a challenge! I was looking for the winning condition in the tags.

I added the criterion to the tags, and removed one of the less interesting ones ;). I know the question itself shouldn't be that hard to solve, but I doubt the golfing languages can generate gifs easily.
I could remove the bonuses, but then how do I motivate people to still try to complete those tasks?

Our mere presence on this SE is motivation enough for us to complete challenges! ;)

Yeah, I don't think the bonuses are a good idea, especially since there at least two animation-capable ASCII-art focused golflangs

Oh also what would n be used for if l and w are also inputs??????????? And would the Peano curve be a special case - it's not the only spacefilling curve, so some algorithms may have to specialcase it

Also, what stops anyone from making a trivial spacefilling curve (just zigzagging back and forth) for non-square dimensions

Bonuses in code golf is one of the most agreed-upon things to avoid when writing challenges. I suggest you remove them and decide which is to be the canonical version of the challenge.

Is that OK if the output is mirrored horizontally and/or vertically?

@Arnauld Yes, that's alright

Even if you're going to keep the bonises, please address this comment. Which curve sd be used for retangulr outpt?

A continuous space-filling curve which looks like the Peano curve while covering the rectangle. If it does this, it's acceptable output.

@ASCII-only A true "space filling curve" is the continuous function that is the limit of such drawings (its own drawing would just be a solid black rectangle), and you cannot actually get a continuous function in the limit from zigzagging.

Are we allowed to draw it upside down?

Sure! @LiefdeWen

Mathematica, score 60 - 100 - 100 = -140
Graphics[PeanoCurve@a~Reverse~3~Scale~#2]~Animate~{a,1,#,1}&

Pure function. Takes n and {l, w} (width and height) as input, and gives an animated graphic as output. It first creates a nth order Peano curve with PeanoCurve. Since the l = w case still needs to create a Peano curve, we flip the expression at level 3, similar to DavidC's answer; for l ≠ w, we just Scale the curve to the rectangle. This curve will still be space-filling, satisfying the second bonus. For the first bonus, we just Animate it over all sizes. Note that OP suggested that this was sufficiently different from DavidC's to warrant its own answer. The result for n = 3, l = w = 1 is as follows:

very nice! (with proper orientation too)

GFA Basic 3.51 (Atari ST), 156 134 124 bytes
A manually edited listing in .LST format. All lines end with CR, including the last one.
PRO f(n)
DR "MA0,199"
p(n,90)
RET
PRO p(n,a)
I n
n=n-.5
DR "RT",a
p(n,-a)
DR "FD4"
p(n,a)
DR "FD4"
p(n,-a)
DR "LT",a
EN
RET

Expanded and commented
PROCEDURE f(n)      ! main procedure, taking the number 'n' of iterations
  DRAW "MA0,199"    !   move the pen to absolute position (0, 199)
  p(n,90)           !   initial call to 'p' with 'a' = +90
RETURN              ! end of procedure
PROCEDURE p(n,a)    ! recursive procedure taking 'n' and the angle 'a'
  IF n              !   if 'n' is not equal to 0:
    n=n-0.5         !     subtract 0.5 from 'n'
    DRAW "RT",a     !     right turn of 'a' degrees
    p(n,-a)         !     recursive call with '-a'
    DRAW "FD4"      !     move the pen 4 pixels forward
    p(n,a)          !     recursive call with 'a'
    DRAW "FD4"      !     move the pen 4 pixels forward
    p(n,-a)         !     recursive call with '-a'
    DRAW "LT",a     !     left turn of 'a' degrees
  ENDIF             !   end
RETURN              ! end of procedure

Example output

Perl 6, 117 bytes
{map ->\y{|map {(((++$+y)%2+$++)%3**(y+$^v,*/3...*%3)??$^s[$++%2]!!'│')xx$_*3},<┌ ┐>,$_,<└ ┘>,1},^$_}o*R**3

Try it online!
0-indexed. Returns a 2D array of Unicode characters. The basic idea is that for lower rows, the expression
(x + (x+y)%2) % (3 ** trailing_zeros_in_base3(3*(y+1)))

yields the pattern
|....||....||....||....||..  % 3
..||....||....||....||....|  % 3
|................||........  % 9
..||....||....||....||....|  % 3
|....||....||....||....||..  % 3
........||................|  % 9
|....||....||....||....||..  % 3
..||....||....||....||....|  % 3
|..........................  % 27

For upper rows, the expression is
(x + (x+y+1)%2) % (3 ** trailing_zeros_in_base3(3*(y+3**n)))

Explanation
{ ... }o*R**3  # Feed $_ = 3^n into block

map ->\y{ ... },^$_  # Map y = 0..3^n-1

|map { ... },<┌ ┐>,$_,<└ ┘>,1  # Map pairs (('┌','┐'),3^n) for upper rows
                               # and (('└','┘'),1) for lower rows.
                               # Block takes items as s and v

( ... )xx$_*3  # Evaluate 3^(n+1) times, returning a list

 (++$+y)%2  # (x+y+1)%2 for upper rows, (x+y)%2 for lower rows
(         +$++)  # Add x
                   (y+$^v,*/3...*%3)  # Count trailing zeros of 3*(y+v) in base 3
                3**  # nth power of 3
               %  # Modulo
??$^s[$++%2]  # If there's a remainder yield chars in s alternately
!!'│'         # otherwise yield '│'

K (ngn/k), 37 27 26 bytes
{+y,(|'y:x,,~>+x),x}/1,&2*

Try it online!
returns a boolean matrix
|'y is syntax specific to ngn/k. other dialects require a : to make an each-ed verb monadic: |:'y

To make the output more beautiful, highlight all occurences of 1  (if supported by your browser)

@user202729 done - in the footer so it don't affect the byte count

Wolfram Language 83 36 bytes, (possibly -48 bytes with bonus)
As of version 11.1, PeanoCurve is a built-in.
My original, clumsy submission wasted many bytes on GeometricTransformation and ReflectionTransform.
This much reduced version was suggested by alephalpha.
Reverse was required to orient the output properly.
Graphics[Reverse/@#&/@PeanoCurve@#]&

Example 36 bytes
Graphics[Reverse/@#&/@PeanoCurve@#]&[3]

Bonus
If this qualifies for the 100 pt bonus, it weighs in at 52 - 100 = -48
The code [5] was not counted, only the pure function.
Table[Graphics[Reverse/@#&/@PeanoCurve@#]&@k{k,#}&[5]

Graphics[Reverse/@#&/@PeanoCurve@#]&

It feels a bit like cheating to have a function which calculates the Peano curve by itself, but I'll take it as accepted answer since it's pretty impressive nonetheless ;).
@LegionMammal978 I think you deserve to post your own answer, I'd argue that it's different enough to warrant accepting it as winning answer.

HTML+SVG+JS, 224 213 bytes
The output is mirrored horizontally.
n=>document.write(`<svg width=${w=3**n*9} height=${w}><path d="M1 ${(p=(n,z)=>n--&&(p(n,-z,a(a(p(n,-z,d+=z)),p(n,z))),d-=z))(n*2,r=d=x=y=1,a=_=>r+=`L${x+=~-(d&=3)%2*9} ${y+=(2-d)%2*9}`)&&r}"fill=#fff stroke=red>`)

Try it online! (prints the HTML)

(
n=>document.write(`<svg width=${w=3**n*9} height=${w}><path d="M1 ${(p=(n,z)=>n--&&(p(n,-z,a(a(p(n,-z,d+=z)),p(n,z))),d-=z))(n*2,r=d=x=y=1,a=_=>r+=`L${x+=~-(d&=3)%2*9} ${y+=(2-d)%2*9}`)&&r}"fill=#fff stroke=red>`)
)(3)

BBC BASIC, 142 ASCII characters (130 bytes tokenised)
Download interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html
I.m:q=FNh(m,8,8,0)END
DEFFNh(n,x,y,i)
IFn F.i=0TO8q=FNh(n-1,x-i MOD3MOD2*2*x,y-i DIV3MOD2*2*y,i)DRAWBY(1AND36/2^i)*x,y*(12653/3^i MOD3-1)N.
=0

Stax, 19 bytes
∩▐j>♣←╙~◘∩╗╢\a╘─Ràô

Run and debug it
Output for 3:
███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ █
█ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███
█         █ █         █ █         █ █         █ █
█ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███
███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █
    █ █         █ █         █ █         █ █         █
███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █
█ ███ ███ ███ ███ ███ ███ ███ ███ █ █ ███ ███ ███ ███
█                                 █ █
█ ███ ███ ███ ███ ███ ███ ███ ███ █ █ ███ ███ ███ ███
███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █
    █ █         █ █         █ █         █ █         █
███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █
█ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███
█         █ █         █ █         █ █         █ █
█ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███
███ ███ ███ ███ █ █ ███ ███ ███ ███ ███ ███ ███ ███ █
                █ █                                 █
███ ███ ███ ███ █ █ ███ ███ ███ ███ ███ ███ ███ ███ █
█ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███
█         █ █         █ █         █ █         █ █
█ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███
███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █
    █ █         █ █         █ █         █ █         █
███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █ █ ███ ███ █
█ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███

Logo, 89 bytes
to p:n:a
if:n>0[rt:a
p:n-1 0-:a
fw 5
p:n-1:a
fw 5
p:n-1 0-:a
lt:a]end
to f:n
p:n*2 90
end

Port of @Arnauld's Atari BASIC answer. To use, do something like this:
reset
f 3

Sadly the link no longer works but you can paste the code into this online interpreter.

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


text:
Number of transformations until repeat
Given a sequence of integers or to be more specific a permutation of 0..N
transform this sequence as following:

output[x] = reverse(input[input[x]])
repeat

For example: [2,1,0] becomes [0,1,2] and reversed is [2,1,0]. [0,2,1] becomes [0,1,2] and reversed [2,1,0].
Example 1
In:   0 1 2
S#1:  2 1 0
S#2:  2 1 0
Output: 1

Example 2
In:   2 1 0
S#1:  2 1 0
Output: 0

Example 3
In:   3 0 1 2
S#1:  1 0 3 2
S#2:  3 2 1 0
S#3:  3 2 1 0
Output: 2

Example 4
In:   3 0 2 1
S#1:  0 2 3 1
S#2:  2 1 3 0
S#3:  2 0 1 3
S#4:  3 0 2 1
Output: 3

Your task is to define a function (or program) that takes a permutation of
integers 0..N and returns (or outputs) the number of steps until a permutation occurs that has already occured. If X transforms to X then the output should be zero, If X transforms to Y and Y to X (or Y) then the output should be 1.
Y -> Y: 0 steps
Y -> X -> X: 1 step
Y -> X -> Y: 1 step
A -> B -> C -> D -> C: 3 steps
A -> B -> C -> D -> A: 3 steps
A -> B -> C -> A: 2 steps
A -> B -> C -> C: 2 steps
A -> B -> C -> B: also 2 steps

Testcases:
4 3 0 1 2 -> 0 3 4 1 2 -> 4 3 2 1 0 -> 4 3 2 1 0: 2 steps
4 3 2 1 0 -> 4 3 2 1 0: 0 steps
4 3 1 2 0 -> 4 1 3 2 0 -> 4 3 2 1 0 -> 4 3 2 1 0: 2 steps
1 2 3 0 4 -> 4 1 0 3 2 -> 0 3 4 1 2 -> 4 3 2 1 0 -> 4 3 2 1 0: 3 steps
5 1 2 3 0 4 -> 0 5 3 2 1 4 -> 1 5 3 2 4 0 -> 1 4 3 2 0 5 ->
  5 1 3 2 0 4 -> 0 5 3 2 1 4: 4 steps

If your language doesn't support "functions" you may assume that the sequence is given as whitespace seperated list of integers such as 0 1 2 or 3 1 0 2 on a single line.
Fun facts:

the sequence 0,1,2,3,..,N will always transform to N,...,3,2,1,0
the sequence N,..,3,2,1,0 will always transform to N,..,3,2,1,0
the sequence 0,1,3,2,...,N+1,N will always transform to N,...,3,2,1,0

Bonus task:
Figure out a mathematical formula.
Optional rules:

If your language's first index is 1 instead of 0 you can use permutations 1..N (you can just add one to every integer in the example and testcases).

I meant more like a "closed formula" such as $f(a_{0},a_{1},a_{...}} = a_{0}^a_{1}+...$ where $a_{i}$ is the i-th element in the given sequence.

Are you sure such a "closed formula" exists?

"returns (or outputs) the number of steps until a permutation occurs that has already occured." This is inconsistent with just about everything that follows it. For a start, it makes a return value of 0 impossible...

Is the 3rd example correct? I see 3,0,1,2 should transform to 2,3,0,1

It's the number of transformations before a repeat.

@FireCubez don't forget the reverse.

JavaScript (ES6), 54 bytes
a=>~(g=a=>g[a]||~-g(g[a]=a.map(i=>a[i]).reverse()))(a)

Try it online!

What does [] do on a function?

A function is an object. So, g[a] can be used on it to access the property a.

Ah I see. You're using g to store the state in.

Python 2, 67 bytes
f=lambda l,*h:len(h)-1if l in h else f([l[i]for i in l][::-1],l,*h)

Try it online!

Pyth, 10 9 8 bytes
tl.u@LN_

Explanation:
t               One less than
 l              the number of values achieved by
  .u            repeating the following lambda N until already seen value:
    @LN_N         composing permutation N with its reverse
         Q      starting with the input.

Test suite.

Perl 6, 44 35 bytes
-9 bytes thanks to nwellnhof
{($_,{.[[R,] |$_]}...{%.{$_}++})-2}

Try it online!
Explanation:
{                              }  # Anonymous code block
                  ...    # Create a sequence where:
  $_,  # The first element is the input list
     {.[[R,] |$_]} # Subsequent elements are the previous element reverse indexed into itself
                     {        }    # Until
                      %.{$_}       # The index of the listt in an anonymous hash is non-zero
                            ++     # Then post increment it
 (                            )-2  # Return the length of the sequence minus 2

Haskell, 52 bytes
([]#)
a#x|elem x a= -1|n<-x:a=1+n#reverse(map(x!!)x)

Try it online!
a # x                -- function '#' takes a list of all permutations
                     -- seen so far (-> 'a') and the current p. (-> 'x')
  | elem x a = -1    -- if x has been seen before, return -1
  | n<-x:a =         -- else let 'n' be the new list of seen p.s and return
    1 +              -- 1 plus
       n #           -- a recursive call of '#' with the 'n' and
        reverse ...  -- the new p.

([]#)                -- start with an empty list of seen p.s

J, 33 27 26 bytes
-7 thanks to bubbler
_1(+~:i.0:)|.@C.~^:(<@!@#)

Try it online!
how
original explanation.  my last improvement only changes the piece which finds "the index of the first element we've seen already".  it now uses the "nub sieve" to do it in fewer bytes.
1 <:@i.~ [: ({: e. }:)\ |.@C.~^:(<@!@#)
                        |.@C.~          NB. self-apply permutation and reverse
                              ^:        NB. this many times:
                                (<@!@#) NB. the box of the factorial of the
                                        NB. the list len.  this guarantees
                                        NB. we terminate, and the box means
                                        NB. we collect all the results
         [: ({: e. }:)\                 NB. apply this to those results:
                      \                 NB. for each prefix
             {: e. }:                   NB. is the last item contained in
                                        NB. the list of previous items?
1 <:@i.~                                NB. in that result find:
1    i.~                                NB. the index of the first 1
  <:@                                   NB. and subtract 1

Note the entire final phrase 1<:@i.~[:({:e.}:)\ is devoted to finding "the index of the first element which has already been seen."  This seems awfully long for obtaining that, but I wasn't able to golf it more.  Suggestions welcome.

Jelly, 6 bytes
Ṛị$ƬL’

Try it online!
1-indexed.

Dyalog APL, 29 28 27 bytes
¯2∘+∘≢{⍵,⍨⊂⌽(⍋⍳⊢)⊃⍵}⍣{⍺≢∪⍺}

Takes boxed arrays. Will trainify and explain later.
Try it here as a test suite.

Clean, 90 bytes
import StdEnv
$l=length(until(\[h:t]=any((==)h)t)(\[h:t]=[reverse(map((!!)h)h),h:t])[l])-2

Try it online!


text:
Largest and Smallest Possible Number
Task
Given an array of non-negative numbers, output the largest and smallest possible number that can be formed by joining them.
Rules
Input,Output can be in any convenient format.
The array may have at most 1 decimal number.
Examples
input:[22,33,44,55.55,33]
output:4433332255.55,55.5522333344

input:[34,900,3,11,9]
output:990034311,113349009

input:[99.93,9,3,39]
output:939399.93,99.933399

input:[45.45,45,45,45]
output:45454545.45,45.45454545

input:[12,21,34,43,45.1]
output:4334211245.1,45.112213443

This is code-golf so shortest code wins.

Wouldn't the first output be: 4422333355.55, 55.5544333322? Those are smaller and larger respectively.

@ouflak, you have to output the largest and smallest.

Nevermind, see it now. Got confused with the decimal place.

Would [[55.55,22,33,33,44],[44,33,33,22,55.55]] be an acceptable output format?

@Shaggy, no, the output must be 2 numbers only.

Can I take a list of strings? i.e. ["22", "33", "44", "55.55", "33"]

Can we assume that the array contains at least to elements?

@wastl, list of strings is fine and the array will have at least one element.

Does the output have to be in (max, min) order, or can it be the other way around?

Any way is fine @Jordan

Python 2, 84 80 78 76 bytes
lambda a:[''.join(sorted(a,key=lambda s:'.'in s or s+s)[::i])for i in[-1,1]]

Try it online!
-2 bytes, thanks to Arnauld

Jelly, 6 bytes
Œ!VṢ.ị

Try it online!
Explanation:
Œ!VṢ.ị Arguments: x
Œ!     Permutations of x
  V    Concatenate the representations of each permutation's elements and evaluate the result as Jelly code
   Ṣ   Sort
    .ị Get element at index 0.5, i.e. elements at indices 0 (last) and 1 (first)

I never program in Jelly, but .ị is a pretty cool way of getting both the first and last item of a list. Nice answer! +1 from me.

@KevinCruijssen It actually gets the last and first item. :P

I've also never programmed in Jelly, but I'm confused as to how .ị works. If I'm reading the docs correctly, I would think ị gets the element of y at floor(x) and ceil(x), and . is 0.5. Doesn't that mean it will get elements of y at index 0 and 1?

Is Jelly 1-based indexed? That would explain this behavior but I don't see anything about that in the docs.

@Cowabunghole Yes, Jelly is 1-indexed.

BTW, why so much interest about this .ị here, it's just a normal thing...

I was interested because Jelly programs usually go over my head but this one was short and simple so I was trying to figure it out. I was able to understand it up to the .ị and was just confused by the indexing. Thanks!

Japt, 14 11 10 bytes
á m¬ñn gJò

Try it online!

Nice one. I had á ®¬nÃn for the first line - kicking myself that I didn't think of your way.

12 bytes, using the -h flag.

11 bytes, using the -g flag. Also works with í instead of ï.

Dang! Looks like I gave up to soon; very nicely done.

Yep. Oliver helped me in the chat! very clever way to get first and last value from an array!

Japt, 14 11 bytes
á m¬ñn é v2

Try it
1 byte saved thanks to Luis, please +1 his solution too.
á               :Permutations
  m             :Map
   ¬            :  Join
    ñ           :Sort by
     n          :  Converting each to a number
       é        :Rotate right
         v2     :Remove & return the first 2 elements

Ok, this is better!! damn!! that é was hidden all this time!!

05AB1E, 11 bytes
œJΣ'.¡ï}Á2£

Try it online!
or as a Test Suite
Explanation
 œ             # get permutations of input
  J            # join each
   Σ    }      # sort by
    '.¡        # splitting into [before decimal, after decimal]
       ï       # and converting each to int
         Á     # rotate the result right
          2£   # and take the first 2 values

Too bad we don't have a cast to float. I remember there was one in the Legacy, but I just looked it up and apparently it was a stringified cast to float, which is pretty useless since you want floats instead of strings to sort on.. xD

@KevinCruijssen: Yeah. We had an is_number but unfortunately no to_number.

JavaScript (ES6), 68 66 bytes
a=>[1,-1].map(n=>a.sort((a,b)=>[a%1||a]+b<[b%1||b]+a?n:-n).join``)

Try it online!
How?
We use the following test to compare two values in the input array:
[a % 1 || a] + b < [b % 1 || b] + a

The expression x % 1 || x returns the decimal part of \$x\$ if \$x\$ is a decimal number, or leaves \$x\$ unchanged otherwise.
The expression [x % 1 || x] + y coerces the above result to a string and concatenates it with the other value.
If there's a decimal number in the list, it must always be considered as the smallest value. By applying our conversion, a decimal number is turned into a string starting with "0.", which is lexicographically ordered before anything else.
Examples:
  a |   b | [a%1||a]+b | [b%1||b]+a
----+-----+------------+------------
  4 |   5 | "45"       | "54"
 10 |  11 | "1011"     | "1110"
  8 |  80 | "880"      | "808"
  7 | 9.5 | "79.5"     | "0.57"

Ruby, 56 45 bytes
->a{a.permutation.map{|p|p.join.to_f}.minmax}

Try it online!
-11 bytes, thanks Jordan

Nice work! You can save 2 bytes by dropping the parentheses around your argument (->a{...) and another 9 by using the handy minmax method: https://tio.run/##XVDbasMwDH3fVwj2soEmqosfPNh@pIThjQUymsQUB1bafnumOIylkwxH8tE5WD5O76e5fZmfXtM5Uf489lNJpRsH6lM@X/Il09fYDVTGt/ZKfTf06fs6Z2jpIx0OD3sRVEUzDIFC8Lp5hHsYp5Kn8gxm6iGyklBBZLkzu/szUcO426EiM8YGPLYm0Tk1dQ6YXelt3IhjpKgYXa2r9lasnnUCKqh3G7EFsoC/p/kntrDmMgMV1twYsKAw@gLmvxCIm1sDf64wy8JUB6@FfXmdfwA

Pyth, 13 12 bytes
hM_BSvsM.p`M

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.
hM_BSvsM.p`MQ   Implicit: Q=eval(input())
                Trailing Q inferred
          `MQ   Stringify all elements of Q
        .p      Generate all permutations of the above
      sM        Concatenate each permutation
     v          Evaluate each as a number
    S           Sort them
  _B            Pair the sorted list with its reverse
hM              Take the first element of each, implicit print

Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p

Perl 6, 41 bytes
{.max,.min}o+<<*.permutations.map(*.join)

Try it online!
Alternatives:
{.max,.min}o+<<*.permutations.map:{.join}
{.max,.min}o{[map +*.join,.permutations]}
{.max,.min}o{+<<map *.join,.permutations}

Husk, 10 bytes
§,▼▲morṁsP

Try it online or verify all!
Explanation
§,▼▲m(rṁs)P  -- example input: [2,3,1.1]
          P  -- permutations: [[2,3,1.1],[3,2,1.1],[1.1,3,2],[3,1.1,2],[1.1,2,3],[2,1.1,3]]
    m(   )   -- map the following
                (example with [1.1,2,3])
       ṁs    -- | show each and join: "1.123"
      r      -- | read: 1.123
             -- : [231.1,321.1,1.132,31.12,1.123,21.13]
§,           -- fork and join as tuple
  ▼          -- | min: 1.123
   ▲         -- | max: 321.1
             -- : (1.123,321.1)


text:
Strange Addition
Challenge
Calculate the strange sum of two natural numbers (also known as lunar addition):
Given \$A=...a_2 a_1 a_0\$ and \$B=... b_2 b_1 b_0\$ two natural numbers written in the decimal base, the strange sum is defined, based on the maximum operation, as:
\$A+B=... \max(a_2,b_2) \max(a_1,b_1) \max(a_0,b_0)\$
   ...         a2         a1         a0
 + ...         b2         b1         b0
 ----------------------------------------
   ...  max(a2,b2) max(a1,b1) max(a0,b0)

Input
Two natural numbers
All the following is allowed:

Zero-padded strings (same length)
Left-space-padded strings
Right-space-padded strings
Array of two padded strings
2D space-padded char array

Output
A natural numbers
Example
1999 + 2018 -> 2999
17210 + 701 -> 17711
32 + 17     -> 37
308 + 250   -> 358
308 + 25    -> 328

Rules

The input and output can be given in any convenient format (choose the most appropriate format for your language/solution).
No need to handle negative values or invalid input
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
If possible, please include a link to an online testing environment so other people can try out your code!
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

also known as lunar addition

Can we take the input as zero-padded strings (same length)?

I think this is a bit too trivial. Weird that has not been asked before

Can we get/output lists of digits?

Can we have the numbers in the same length? Like 17210 00701 instead of 17210 701 ?

@EriktheOutgolfer see first rule

@mdahmoune Yeah, would it be convenient enough?

@mdahmoune can we take the input as two numbers in the same length, with leading zeroes in the second one?

@WindmillCookies the challenge is more interesting when no zeros fill

Are leading spaces in the output allowed?

@BMO yes it is ok leading spaces in the output

I fail to see what input formats are allowed exactly. The input format is very important in this challenge, as some formats allow much easier processing. What of the following are allowed? 1) Zero-padded strings (same length) 2) Left-space-padded strings 3) Right-space-padded strings. 4) Array of two padded strings. 5) 2D space-padded char array. Voting to close and downvoting for now; I will happily remove my votes when solved

@LuisMendo choose the most appropriate format for your language

@mdahmoune Above you say that input as zero-padded strings is disallowed. Here you say zero-padded strings and space-padded char arrays are both allowed. Which is it?

@lirtosiast I only said that the challenge is more interesting with no padding

Python 2, 20 bytes
lambda*a:map(max,*a)

Try it online!
I/O as 0-pre-padded lists of digits.

Jelly, 1 byte
»

Try it online!
I/O as 0-pre-padded lists of digits.

R, 68 65 bytes
function(x)apply(outer(x,10^(max(nchar(x)):1-1),`%/%`)%%10,2,max)

Try it online!
Input as integers, output as list of digits.
If zero-padding lists of digits was allowed, then simply pmax would suffice.

MATL, 2 bytes
X>

Choose the most appropriate format for your language/solution

The input format is: 2D char array of two rows, each corresponding to a line, with the shorter number left-padded with spaces. For example
17210
  701

which in MATL is defined as
['17210'; '  701']

Try it online!
Explanation
      % Implicit input: 2D char array with two rows
X>    % Take maximum of (code points of) each column
      % Implicit display

Python 2, 73 60 56 bytes
lambda a,b:map(max,zip(a.rjust(len(b)),b.rjust(len(a))))

Try it online!
Takes input as two strings, and returns a list of digits

Alternative:
Takes input as two integers; same output
Python 2, 60 59 bytes
lambda*i:map(max,zip(*['%*d'%(len(`max(i)`),v)for v in i]))

Try it online!

Java 10, 78 57 bytes
a->b->{for(int i=a.length;i-->0;)if(a[i]<b[i])a[i]=b[i];}

Input as two space-padded character arrays.
Modifies the first input-array instead of returning a new one to save 21 bytes (thanks to @OlivierGrégoire).
Try it online.
Explanation:
a->b->{            // Method with two char-array parameters and String return-type
  for(int i=a.length;i-->0;)
                   //  Loop `i` in the range (length, 0]:
    if(a[i]<b[i])  //   If the `i`'th character in input `a` is smaller than in input `b`:
      a[i]=b[i];}  //    Change the `i`'th character in `a` to the `i`'th character of `b`

a->b->{for(int i=a.length;i-->0;)if(a[i]<b[i])a[i]=b[i];} (57 bytes). Reuse a as output to gain much, much bytes.

@OlivierGrégoire Ah, can't believe I hadn't thought of that. Thanks! :D

J, 14  12 bytes
-2 bytes thanks to Jonah
(>./@,:)&.|.

Try it online!
Input and output as list(s) of digits

12 bytes: (>./@,:)&.|..  Try it online!

if you’re looking for a challenge, see if you can improve this monstrosity: https://codegolf.stackexchange.com/a/175968/15469

05AB1E, 9 6 5 bytes
-3 thanks to Emigna
-1 thanks to Shaggy
íζ€àR

Takes input as a list of lists of digits
í      # Reverse both inputs
 ζ     # Zip
  €à   # Keep the bigger digits
    R  # Reverse

Try it online! or Try all test cases

€R can be í. Also, I don't think you need €þ as number > space

@Emigna Thanks! I thought I tried it without €þ and it didn't work, but now it does...

Do you need the J at the end?

@Shaggy No, I guess I don't. Thanks!

It's lame, but the rules allow a 3 byte solution by taking a 2D space-padded char array..

Japt, 9 8 7 bytes
Takes input as an array of digit arrays.
mÔÕÔËrw

Try it
m            :Map
 Ô           :  Reverse
  Õ          :Transpose
   Ô         :Reverse
    Ë        :Map
     r       :  Reduce by
      w      :  Maximum

If taking zero-padded arrays as input is permitted (it would currently fall under a "convenient format" but I suspect that's not the challenger's intent) then this can be 3 bytes.
íwV

Try it
í       :Interleave the first input
  V     :With the second
 w      :Reduce each pair by maximum

Here's another 8 byte solution with a different strategy and simpler input format. maybe you can shave a byte from that?

@KamilDrakari: Uncanny - I was just updating with the exact same solution!

Interestingly, the version that separates the "transpose" and "reduce" steps is also 8 bytes because of better shortcuts

@KamilDrakari, oh, we have a shortcut for y now? I did not know that. Here's another way, also 8 bytes.

Ooh, that's a neat trick with '. I don't know whether that would ever save bytes, but it's definitely cool.

Haskell, 40 bytes
a#b=zipWith max(p b++a)$p a++b
p=(' '<$)

Input/output as strings, try it online!
Explanation
The function p replaces each character by a space, using p b++a and p a++b are thus the same length. This way we can use zipWith without losing any elements, using max with it works because a  (space) has lower codepoint than any of the characters ['0'..'9'].

Perl 6, 37 bytes
{[R~] roundrobin($_».reverse)».max}

Try it online!
Takes input as a list of lists of digits.

Perl 6, 15 bytes
{[~] [Zmax] $_}

Try it online!
Takes input as a list of space padded arrays of characters, though for this challenge the lax input format makes it rather boring. Alternatively, here's the program that takes a list of two integers instead:
Perl 6, 41 bytes
{+[~] [Zmax] $_>>.fmt("%{.max}d")>>.comb}

Try it online!
If you don't mind a huge amount of whitespace, you can also remove the + from the front.
Explanation:
{                                       }  # Anonymous code block
             $_>>    # Map each integer to
                 .fmt("%{.max}d") # The number padded by the max of the list spaces
                                 >>.comb   # And split each to list of characters
      [Zmax]  # Get the max of each digit at each index
              # This works because space is coerced to 0
              # Otherwise we would have to add a 0 to the formatting string
  [~]   # Join the list of digits and spaces
 +      # And coerce the string to a number to get rid of leading whitespace

JavaScript (ES6), 51 49 bytes
NB: This answer was posted before the loose I/O formats were explicitly allowed. With zero-padded arrays of digits, this can be done in 33 bytes, (but is much less interesting, IMHO).
Takes input as two integers. Returns an integer.
f=(a,b,t=10)=>a|b&&(a%t<b%t?b:a)%t+t*f(a/t,b/t)|0

Try it online!
Commented
f = (                     // f = recursive function taking:
  a,                      //   a = first integer
  b,                      //   b = second integer
  t = 10                  //   t = 10 (which is used 6 times below)
) =>                      //
  a | b                   // bitwise OR between a and b to test whether at least one of
                          // them still has an integer part
  &&                      // if not, stop recursion; otherwise:
  (                       //
    a % t < b % t ? b : a // if a % 10 is less than b % 10: use b; otherwise: use a
  ) % t +                 // isolate the last decimal digit of the selected number
  t *                     // add 10 times the result of
  f(a / t, b / t)         // a recursive call with a / 10 and b / 10
  | 0                     // bitwise OR with 0 to isolate the integer part

Alternate version
Same I/O format.
f=(a,b)=>a|b&&[f(a/10,b/10)]+(a%10<b%10?b:a)%10|0

Try it online!

You can get much shorter if you assume your input to be a 2d space padded char array.

Hi! Could you provide some explanation? I ""tried"" to do this challenge in JavaScript but I failed and would like to see how your solution works :)

@Neyt I've added a commented version. The alternate version is using the same logic; the only difference is that we add the next digit to the left as a string instead of multiplying the result of the recursive call by 10.

@Arnauld Thank you! :)

Python 3, 53 bytes
s=lambda p,q:p+q and 10*s(p//10,q//10)+max(p%10,q%10)

Welcome to CGCC! Nice Answer. Writing answers is simpler when you host them on Try it online.

Tcl, 156 bytes
proc S a\ b {join [lmap x [split [format %0[set l [expr max([string le $a],[string le $b])]]d $a] ""] y [split [format %0$l\d $b] ""] {expr max($x,$y)}] ""}

Try it online!
Not very golfy, but I had to give a try on it. Will golf it later!

Tcl, 159 bytes Failed outgolf

Batch, 120 bytes
@set/aw=1,x=%1,y=%2,z=0
@for /l %%i in (0,1,9)do @set/a"z+=w*((v=y%%10)+(v-=x%%10)*(v>>4)),y/=10,x/=10,w*=10
@echo %z%

Takes input as command-line parameters. 188-byte version works on arbitrary length integers:
@set/px=
@set/py=
@set z=
:l
@if %x:~-1% gtr %y:~-1% (set z=%x:~-1%%z%)else set z=%y:~-1%%z%
@set x=%x:~,-1%
@set y=%y:~,-1%
@if "%x%" neq "" if "%y%" neq "" goto l
@echo %x%%y%%z%

Takes input on STDIN.

Twig, 125 bytes
When I saw this challenge, I though: "let me use a template language! sure is a good fit"
I was wrong ... so wrong .... ... But was fun!
{%macro a(a,b,s='')%}{%for k,x in a|reverse|split('')%}{%set s=max(x,(b|reverse|split('')[k]))~s%}{%endfor%}{{s}}{%endmacro%}

This requires that "strict_variables" is set to false (default value).
To use this macro, you can do like this:
{% import 'file.twig' as my_macro %}

{{ my_macro.a(195,67) }}

Should display 167.
You can try this in https://twigfiddle.com/rg0biy
("strict_variables" set to off, it is on by default on the website)

Ceylon, 55 / 99
With 0- or space-padded strings of same length (returning an iterable of characters):
function t(String a,String b)=>zipPairs(a,b).map(max);

With 0- or space-padded strings (returning a String):
String t(String a,String b)=>String(zipPairs(a,b).map(max));

With strings of possibly different length (returning a String):
String u(String a,String b)=>String(zipPairs(a.padLeading(b.size),b.padLeading(a.size)).map(max));

Husk, 5 bytes
↔¤żY↔

Conveniently takes input/output as list of digits, try it online or verify all!
Explanation
↔¤żY↔  -- example inputs [1,4] [3,2]
 ¤  ↔  -- reverse the arguments of: [4,1] [2,3]
  żY   -- | zipWith (keeping elements of longer) max: [4,3]
↔      -- reverse: [3,4]

Stax, 5 bytes
|>E:o

Run and debug it
This program takes input as an array of strings.
|>  Right align inputs (filling with \0)
E   "Explode" array onto stack separately
:o  "Overlay" Keep the maximum element respective element from two arrays.

Run this one
This is the first time I've seen a use for the overlay instruction "in the wild".

SNOBOL4 (CSNOBOL4), 153 bytes
	X =INPUT
	Y =INPUT
	Y =DUPL(0,SIZE(X) - SIZE(Y)) Y
S	X LEN(1) . A REM . X	:F(O)
	Y LEN(1) . B REM . Y
	O =O GT(A,B) A	:S(S)
	O =O B	:(S)
O	OUTPUT =O
END

Try it online!

Retina 0.8.2, 39 bytes
+`^(.*)(.)¶(.*)(.)
$1¶$3¶$2$4
%O`.
¶.?

Try it online! Link includes test suite. Previous 45-byte Retina 1 version accepts unpadded strings:
P^`.+
+`^(.*)(.)¶(.*)(.)
$1¶$3¶$2$4
%O`.
¶.?

Try it online! Link includes test suite. Explanation:
P^`.+

Pad both values to the same length. (Retina 1 only. There are ways of emulating this in Retina 0.8.2 but they are not very golfy.)
+`^(.*)(.)¶(.*)(.)
$1¶$3¶$2$4

Transpose the values.
%O`.

Sort each pair into order.
¶.?

Delete all the low digits and surplus newlines.

Charcoal, 8 bytes
⭆θ⌈⟦ι§ηκ

Try it online! Link is to verbose version of code. Explanation:
 θ          First input
⭆           Map over characters and join
  ⌈         Maximum of
   ⟦        List of
    ι       Current character of first input and
      η     Second input
     §      Indexed by
       κ    Current index
            Implicitly print

10-byte version "adds" any number of padded strings:
⭆§θ⁰⌈Ｅθ§λκ

Try it online! Link is to verbose version of code. Previous 14-byte version accepts unpadded strings:
⭆◧θＬη⌈⟦ι§◧ηＬθκ

Try it online! Link is to verbose version of code. Explanation:
  θ             First input
 ◧              Padded to
   Ｌ            Length of
    η           Second input
⭆               Map over characters and join
     ⌈          Maximum of
      ⟦         List of
       ι        Current character of first input and
          η     Second input
         ◧      Padded to
           Ｌ    Length of
            θ   First input
        §       Indexed by
             κ  Current index
                Implicitly print

17-byte version "adds" any number of strings:
≔⌈ＥθＬιη⭆η⌈Ｅθ§◧ληκ

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

The question has been changed so the strings can be input as padded

Nitpicking, but you missed a close paren in the first verbose version :P

@ASCII-only If only TIO matched parens for me ;-)

Pyth, 5 bytes
meSdC

Takes input as array of two space-padded strings.
meSd       map greatest
    C      on the transpose of input

Try it here.

C# (.NET Core), 57 bytes
a=>b=>a.Select((x,i)=>a[i]>b[i]?x:b[i])

-1 bytes by adding currying
Try It Online

You can save 3 bytes when you use x instead of a[i] in condition

Japt, 4 bytes
Input is taken as a an array of two 0-padded number arrays.
y_rw

Try it online!

Ruby, 25 bytes
->a,b{a.zip(b).map &:max}

Try it online!
Pre-padded list blah blah. (Although it feels a little like cheating.)

Wren, 74 bytes
Fn.new{|i|(0...i.count/2).map{|j|i[j]>i[j+i.count/2]?i[j]:i[j+i.count/2]}}

Try it online!
Input is a single list of the two operands, e.g.
[1, 7, 2, 1, 0,
 0, 0, 7, 0, 1]

Explanation
Now I need to figure out a formula for maximum.
Fn.new{|i|                                                               } // New anonymous function with the operand i
          (0...i.count/2)                                                  // Define an exclusive range from 0 to half the input
                         .map{|j|                                       }  // Turn every item of the list into ...
                                 i[j]>i[j+i.count/2]?i[j]:i[j+i.count/2]   // ... The maximum between i[j] and i[j+i.count/2]
                                                                           // (which is simply the other list's index at the same position)

Perl 5 -MList::Util=max -F, 22 bytes
say map{max $_,getc}@F

Try it online!
Input must be 0 or space padded so that the entries are the same length.

APL(NARS), 51 chars, 102 bytes
{k←⌈/≢¨(a b)←⍎¨∘⍕¨⍺⍵⋄f←{((k-≢⍵)⍴0),⍵}⋄10⊥(f a)⌈f b}

test:
  h←{k←⌈/≢¨(a b)←⍎¨∘⍕¨⍺⍵⋄f←{((k-≢⍵)⍴0),⍵}⋄10⊥(f a)⌈f b}
  1999 h 2018
2999
  17210 h 701
17711
  32 h 17
37
  308 h 250
358
  308 h 25
328

Pip, 13 bytes
{aGTb?ab}MZab

Maps zipped pairs of the two inputs and then returns the greater one.
Inputs must be padded with spaces.
Try it online!

Could you specify that inputs must be padded

Added that in. Thanks!

Knight, 45 bytes
;=aP;=bP Wa;O+A I>a bAaAb"\";=aGa 1La=bGb 1Lb

Try it online!
Takes two zero-padded numbers (it works with spaces as well).

Factor, 4 bytes
vmax

Try it online!

Thunno 2, 1 byte
§

Try it online!
I/O as pre-padded lists of digits. Built-in for "dyadic maximum".


text:
Largest Number in Brainfuck BigInt for each program length up to 50 instructions
This challenge is for the largest finite number you can get BrainFuck programs of given lengths to contain in memory.
We must use one of the BF versions that uses big integers for the cells rather than byte values as not to be capped at 255. Do not use negative positions and values in memory. Do not use the BF instruction to input memory, also the output instruction is not needed.

Challenge:
Write Brainfuck programs with lengths from 0 to 50. Your score is the sum of each programs maximum value in memory.

As they may well be trivial feel free to omit the programs listed below and start from a length of 16, I'll use the following for the smaller sizes:
Length, Score, Program
 0,  0
 1,  1, +
 2,  2, ++
 3,  3, +++
Pattern Continues
10, 10, ++++++++++
11, 11, +++++++++++
12, 12, ++++++++++++
13, 16, ++++[->++++<]
14, 20, +++++[->++++<]
15, 25, +++++[->+++++<]

Total Score: 139

Related but different:
Large Numbers in BF
Largest Number Printable
Busy Brain Beaver
See the comments below for more info.

The combined results so far, being the sum of the best of each size:
length: 16 to 24
by sligocki

100, 176, 3175, 3175, 4212
4212, 6234, 90,963, 7,467,842

length: 25 to 30
by sligocki

239,071,921

length: 31, 32, 33, (34 to 37)
by sligocki

        380,034,304
     30,842,648,752
 39,888,814,654,548
220,283,786,963,581

length: 38
based on code by l4m2, by alan2here

(4 ^ 1366 - 4) / 3

length: 39 to 47
based on code by l4m2, by alan2here

Σ (n = 4 to 12) of (fn(0) | f(x) := (4x+2 - 4) / 3)

length: 48
based on code by l4m2, by alan2here

(172) - 2

length: 49, 50
by l4m2

(212) - 2
(262) - 2

How is this challenge different from Large Numbers in BF ?

The Large Numbers question mentions "byte" several times, everyones answers use and rely on single bytes that wrap, this limits answers to trivial cases capped at 255. The program size of 20 at most also prevents the most optimal answer being anything beyond N, N * N or N * (N + 1). There is then almost no challenge at all.

I think the different parameters of this challenge make it qualitatively different enough. The other question should be closed as dupe.

The other question says cells which can take on any integer value without overflowing, though it's impossible to actually get above 255 anyway. This extension seems like a more interesting question (that bans negative positions as well. I don't think eiher should be closed

There's a close connection between true busy beavers (counting execution time) and largest value computers. Clearly calculating a large value by incrementation implies a long execution, but also a long execution implies the possibility of counting the steps to get a large number. Perhaps the closest previous question is in fact https://codegolf.stackexchange.com/q/4813/194 .

Thanks Peter :) Very Interesting! Thats a hell of large upper limit on program size. :-o Good luck to even attempt that questions busiest beaver.

Unfortunately, only the last program really counts for anything with the bigger busy beavers, as there's no point adding the smaller programs to the total. It gets to the ppint where the number is so large that doubling or tripling it doesn't really matter

Why move right at the end if it's the sum of each programs maximum value in memory?

Thank you :-/ I'll fix this.

@lirtosiast feel free to attempt the best for any size, not just 50. It's interesting where the larger size starts to dominate the score, in the middle of the size range, perhaps at size 26 at time of writing.

@lirtosiast The related and epic busy beaver function grows faster than any computable function, so truly optimal solutions to the sizes here could be ridiculously good. I think based on an answer for another question I've seen here that the ackermann function with a 3 digit rank should be possible easily inside 50 instructions.

Indeed, I wouldn't be surprised if that were the case.

Does the number have to be in the first data cell? Does the pointer have to end up on the cell where the number is?

@EmbodimentofIgnorance I would say no and no, given that neither of those are true for the examples.

Yet another similar question: https://codegolf.stackexchange.com/q/155850/39328

(262)-2
+++++[->+++++<]>[->+[->+[->++<]>[-<+>]<<]<[->+<]>]

Where (42) = 2222
f20(0), where f(x):=(4x+2-4)/3
++++[->+++++<]>[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

It can of course be larger, but just hard to express then

Your function appears to take 2 parameters? fn(m) What happens with the 16 in the calculation? Is this the same as (4^18 - 4) / 3 = about 23 billion?

@alan2here That means the result is fed into the function repeatedly, e.g. f(f(f(f(... 0))))

Thank you for the info.

I think it's safe to assume that the 16 is generated by the 44 at the start of the code and credit you with a 54 version as well, what with the unnecessary last character, giving you best so far 49 and 50. :)

Your approach well and truly dominates over ones I came up with for programs of 39 instructions or more.

@alan2here f^3(0) is still fine as 8.646232293002308e+822

@l4m2 What's the closest to 50 bytes you can get a program that meaningfully outscores this (>= 3 Knuth arrows)? I don't know Brainfuck so it's been a struggle for me.

There's been a lot posted about the top of the range (size ~ 50). But here are some high-scoring programs near the bottom:

Size 16: +[->++++++[-<]>] scores 100
Size 20: +[->++++++++++[-<]>] scores 4,212
Size 28: +[->++++++++++++++++++[-<]>] scores 804,576

In general, if we parameterize it so that there are N+1 +s in the middle, then this simulates the "Collatz-like" iteration:

$$C(2k) \to Halt(Nk)$$
$$C(2k+1) \to C(N(k+1))$$

Where C(m) = [0, *m*, 0 ...] (Data pointer looking at value m, at least one zero to the left, infinite 0s to the right).
It turns out that for $$N = 2^m + 1$$ this iterates exactly m+2 times (starting from C(1)) and scores
$$\frac{N}{2} (\frac{N^{m+1} - 2^{m+1}}{N - 2} + 1) \approx \frac{N^{m+1}}{2} \approx N^{\log_2(N)}$$
points using N + 12 size.

Sadly, this is just (slightly) too big to jam into l4m2's tetration machine: +[->++++++[-<]>]>[->+[->+[->++<]>[-<+>]<<]<[->+<]>] has size 51 and scores $$2\uparrow\uparrow 101 − 2$$ (If I understand correctly).

Welcome to Code Golf, and nice answer! Always cool to see more stuff being done in BF.

Lol, It is also exactly to big to profit from using the alan2here's exponential mechine: +[->++++++[-<]>]>[->+[->++<]>[-<+>]<<] has size 38 and scores $$2^{101}-2$$ (IIUC). But Alan's size 38 is $$> 4 \uparrow\uparrow 3 = 2^{512}$$

total: (≈ & >) 172
more detail:
length: 0 to 12
see question
total: 78

length: 13 to 24
N × N
(N + 1) × N
16, 20, 25, 30, 36, 42, 49, 56, 64, 72, 81, 90

++++[->++++<]
+++++[->++++<]
+++++[->+++++<]
Pattern Continues
+++++++++[->++++++++<]
+++++++++[->+++++++++<]
++++++++++[->+++++++++<]

total: 581

total so far: 659

each yeild: fn(0) | f(x) = x × m + 1
length: 25
(m, n) = (5, 4)
156
>+>+>+>+<[>[-<+++++>]<<]>

length: 26
(m, n) = (4, 5)
341
>+>+>+>+>+<[>[-<++++>]<<]>

total: 497

total so far: 1156

each yeild: fr or (r × s)(0) | f(x) = (x + 1) × (p × q)
length: 27
(p, q, r) = (2, 2, 5)
1364
+++++[->+[->++<]>[-<++>]<<]

length: 28
(p, q, r) = (2, 2, 6)
5460
++++++[->+[->++<]>[-<++>]<<]

length: 29
(p, q, r) = (2, 2, 7)
21,844
+++++++[->+[->++<]>[-<++>]<<]

length: 30
(p, q, r) = (2, 2, 8)
87,380
++++++++[->+[->++<]>[-<++>]<<]

total: 116,048

total so far: 117,204
length: 37
(p, q, r, s) = (2, 3, 4, 4)
(≈ & >) (6 ^ 16 = 1,721,598,279,680)
++++[->++++<]>
[->+[->+++<]>[-<++>]<<]

total: (≈ & >) 1,721,598,279,680

total so far: (≈ & >) 1,721,598,396,884

Based a design by l4m2
each yeild: fn(0) | f(x) = (4x + 2 - 4) / 3
length: 38
n = 4
+++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 39
n = 4
++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 40
n = 5
+++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 41
n = 6
++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 42
n = 7
+++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 43
n = 8
++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 44
n = 9
+++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 45
n = 10
++++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 46
n = 11
+++++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 47
n = 12
++++++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

Based a design by l4m2
length: 48
++++[->++++<]>[->+[->+[->++<]>[-<+>]<<]<[->+<]>]

total: 172 - 2

Honorary Mention
(3 × 3) ^ 4
>+<++++[->[->+++<]>[-<+++>]<<]

Revision!
Even bigger numbers now!
++++++++[>+>>++++++++[<<[>+++<-]>[<++++>-]>-]<<<-]

Result: 1.1684220603446423e+69 or 116842206034464220000000000000000000000000000000000000000000000000000
(At least that's what the compiler says)
How?
How this works is that repeats the assignment v=v(4*3)^v 8 times(At least that's what I intended it to do.

Testing this the function looks as if it grows impressively, what function is it? Maybe you can win at one of the other sizes.

Just found a more powerful family of programs in the 16-33 size range. These are programs that look like ++[>+++++[-<]>>] (M+1 +s at start and N+1 +s in middle).
Here are all the ones that beat existing champions (IIUC).
Size 16 / Params M= 1 N= 4 / Score =                  176 / ++[>+++++[-<]>>]
Size 17 / Params M= 1 N= 5 / Score =                3,175 / ++[>++++++[-<]>>]
Size 21 / Params M= 2 N= 8 / Score =                6,234 / +++[>+++++++++[-<]>>]
Size 22 / Params M= 2 N= 9 / Score =               90,963 / +++[>++++++++++[-<]>>]
Size 23 / Params M= 2 N=10 / Score =            7,467,842 / +++[>+++++++++++[-<]>>]
Size 24 / Params M= 2 N=11 / Score =          239,071,921 / +++[>++++++++++++[-<]>>]
Size 30 / Params M= 3 N=16 / Score =          380,034,304 / ++++[>+++++++++++++++++[-<]>>]
Size 31 / Params M= 3 N=17 / Score =       30,842,648,752 / ++++[>++++++++++++++++++[-<]>>]
Size 32 / Params M= 3 N=18 / Score =   39,888,814,654,548 / ++++[>+++++++++++++++++++[-<]>>]
Size 33 / Params M= 3 N=19 / Score =  220,283,786,963,581 / ++++[>++++++++++++++++++++[-<]>>]

Note: These programs all go one spot to left of the starting memory location ... if you want to disallow that, you'll need to prepend them with >.
This program follows the recurrence:
Start -> [M, N*]
[b+k,  b*]  -> Halt(max(Nb, k))
[a,   a+k+1*] -> [k, N(a+1)*]

In other words: if the register to the left has an equal or larger value, it will halt. If current register has greater value, iterate like the second line. All of these recurrences seem to eventually halt, but I don't have any deeper insight yet ...

I think I'm still inching ahead of you at size 37 :)

Sorry @alan2here, I think your size 37 (&36) program needs a > between the first and second line, right?

Thanks, let this be a lesson in the importance of documentation because I cannot quite figure it out, but it'd do noting without the extra ">" and it seems to make a lot of sense so I've corrected my answer and the main scoreboard accordingly. The two of you now draw as grand masters of this challenge. :)


text:
Golf some ones, and a program too
Introduction
Busy Beavers are programs (specifically Turing Machine programs) that aim to output the most ones as possible, while having the least states as possible and halting.

Challenge
Your challenge is to make a busy beaver, which outputs as many ones as possible, but also outputs a second busy beaver. That second busy beaver must be executable in the same language as the original program, and can be no more bytes than the program that produced it
So, for example, say my program was a. That program should aim to print as many 1s as possible, and also output another program, say b, which also aims to print as many 1s as possible and outputs another program etc etc etc. b must be no more bytes than a
The program should be printed after the 1s, separated by any reasonable delimiter.
The outputted programs must also not be the same as any of the previous programs. When no more programs are generated, the scores are calculated from there. For example, program a can print b can print c can print d, but d doesn't print any other program. The scores would be calculated as (a_ones + b_ones + c_ones + d_ones) / (a_bytes + b_bytes + c_bytes + d_bytes) (see below)
The programs must also never error. The "programs" can also be functions, as long as they execute with no arguments

Scoring
Your submission's score is the sum of the number of ones outputted by your programs, all divided by the sum of the bytes of the programs. The higher the score, the better.

Is f=_=>1 and f=_=>2 different programs?

At some point down the rabbit hole, the programs will no longer be able to output new programs different from but no bigger than the previous ones, by the pigeonhole principle. So not all of your requirements can be satisfied at once!

@LuisfelipeDejesusMunoz Yes

@MishaLavrov Oh, forgot to mention that if you can't print anything anymore, the chain stops there and the scores are added

With the current rules, it seems likely that the way to maximize the score is to just print lots of ones, without printing a second program.

@MishaLavrov How is that? One would get a much better score by simply, for example, printing lots of ones, and including a second, smaller program which would probably double the ones count

If the second program prints a similar number of ones, it's probably the same size as the first program. You're dividing by the total size of the programs, so the number you're dividing by also doubles. And there's overhead in printing another program that's not going to printing more ones.

@MishaLavrov repeat 9999**99999999999: print 1; repeat 99: print ",repeat 9999**99999999999: print 1;";

Your second program is now much longer than the first program.

Let us continue this discussion in chat.

@JoKing "The outputted programs must also not be the same as any of the previous programs."

There should probably be a restriction on how long a program could be, since the effect of dividing by the bytecount will be negligible for better busy beavers

scoring bad fot 1-len-chain usually better?

C (gcc), 71 bytes
I've not done one of these before but here's a shot at it;
Each program should print 4,294,967,295 ones, divided by the sum of bytes 71+30 scores 85,048,857
main(c){puts("main(c){while(~c++)puts(\"1\");}");for(;~c++;)puts("1");}

Try it online!

How many 1s is this supposed to print?

JavaScript (Node.js), 50 bytes
(f=_=>_?'1'.repeat(_)+`&&(f=${f})(${_-1})`:1)(1e3)

Try it online!

It seems like you want something more like (f=_=>[...Array(_)].map(a=>1).join\`+`\n(f=${f})(${_-1})`)(1e3)`; otherwise, the output after all the 1s doesn't look like a working program to me. Also, I'm not sure where the factorial in your score is coming from.

1000! would be approximately 4.023872600770938*10^2567. None of your programs output that many ones.

Using && will evaluate the previous numbers as true and will excecute the next line of code that is going to be the same program but with a different number (IDK if this fits into the rules since is not the same program at all)

Lol @MishaLavrov my bad, I'm pretty bad at math Dx

Changing 1e3 to 1e9 will give you a lot more 1s!

@LuisfelipeDejesusMunoz The program printed by your program errors on TIO

It can't refer to itself, as it seems to be

@FireCubez It was because of Shaggys , xD let me rollback

@Shaggy Running the output will cause an error

@FireCubez Check again, but I think this shouldnt be a valid answer since it just calls itself with different parameters. The score of answers like this will be Infinite

The bigger the initial input (in this case is just 1000), the bigger the score

In fact, this errors when given a parameter of -1, so it isn't valid. I should've made that more clear.

1e9 will run on TIO now, but exceed its output limits.

brainfuck, 99 bytes, \$f_{255}(255^2)\$
-[>-[[>]-[<]>>-]<-]-[-[[>]+[<]<+>>-]-[<+>-----]<--.,<[>>>[[-<+>]<[<]<[->+<<+>]>[>]>]<+[<]>,<<-]>>>]

Assumes a wrapping implementation with an infinite tape in both directions.
This is modified from my Largest Number Printable to print 1s instead of 3s.


text:
Number letter counts
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
Output how many letters would be used if all the numbers from 1 to 1000 (one thousand) inclusive were written out in words.
NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.
You must actually calculate it - just printing the predetermined result is not allowed.
Output with any acceptable method.

Probable duplicate of this question

Welcome to PPCG! To prevent hardcoding, I'd strongly recommend to either 1) take a number $1\le N \le 1000$ as input and ask the number of letters used to write $1$ to $N$ or 2) take 2 numbers $A$ and $B$ as input and ask the number of letters used to write $A$ to $B$.

This would be better as "output how many letters are used if the numbers 1 through n were written out" to avoid any question of whether something prints a predetermined result. But I think that's a duplicate.

Yes, it does seem similar enough to be a duplicate, thanks.

It turns out that this is a slightly edited copy of problem 17 from Project Euler. Posting such problems here is strongly discouraged, so it should probably be closed and/or deleted.

I'm voting to close this question as off-topic because this challenge was taken from another site without any reference or authorization.

Mathematica, 38 bytes
StringLength@StringJoin@IntegerName[Range[1000]]

@Doorknob has a leaner implementation:
Tr@StringLength@IntegerName@Range@1000

(* 20961 *)

Explanation
IntegerName[Range[10]]

(* {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"} *)
StringJoin@IntegerName[Range[10]]

(* "onetwothreefourfivesixseveneightnineten" *)
StringLength@StringJoin@IntegerName[Range[10]]

(* 39 *)

Since StringLength threads over lists (and you can use prefix notation for all of these functions), this can be shortened to Tr@StringLength@IntegerName@Range@1000 to save 10 bytes.

@Doorknob:  Oooh... yes.  Nice.  Thanks.

The expected result is 21124. The gap is prime (21124 - 20961 = 163), so it's not $N$ times the same difference. I wonder where it comes from.

When I delete white spaces I get 19169.

Are you also deleting hyphens? And are the numbers formatted the UK way? (three hundred and forty-two)?

Not deleting hyphens.  Obviously, I'm using Wolfram's Mathematica conventions for number words.

FWIW, it seems like IntegerName has language and country options. So, that might be fixable at a (rather) reasonable cost.

I'm not sure that converting from American English to British English is "fixing" the solution.

Common Lisp, 104 98 85 76 75 74 bytes
(princ(loop for i to 999 sum(count-if'both-case-p(format nil"~R"(1+ i)))))

Try it online!


text:
Quaternion square root
Background
Quaternion is a number system that extends complex numbers. A quaternion has the following form
$$ a + bi + cj + dk $$
where \$ a,b,c,d \$ are real numbers and \$ i,j,k \$ are three fundamental quaternion units. The units have the following properties:
$$ i^2 = j^2 = k^2 = -1 $$
$$ ij = k, jk = i, ki = j $$
$$ ji = -k, kj = -i, ik = -j $$
Note that quaternion multiplication is not commutative.
Task
Given a non-real quaternion, compute at least one of its square roots.
How?
According to this Math.SE answer, we can express any non-real quaternion in the following form:
$$ q = a + b\vec{u} $$
where \$ a,b\$ are real numbers and \$ \vec{u} \$ is the imaginary unit vector in the form \$ xi + yj + zk \$ with \$ x^2 + y^2 + z^2 = 1 \$. Any such \$ \vec{u} \$ has the property \$ \vec{u}^2 = -1 \$, so it can be viewed as the imaginary unit.
Then the square of \$ q \$ looks like this:
$$ q^2 = (a^2 - b^2) + 2ab\vec{u} $$
Inversely, given a quaternion \$ q' = x + y\vec{u} \$, we can find the square root of \$ q' \$ by solving the following equations
$$ x = a^2 - b^2, y = 2ab $$
which is identical to the process of finding the square root of a complex number.
Note that a negative real number has infinitely many quaternion square roots, but a non-real quaternion has only two square roots.
Input and output
Input is a non-real quaternion. You can take it as four real (floating-point) numbers, in any order and structure of your choice. Non-real means that at least one of \$ b,c,d \$ is non-zero.
Output is one or two quaternions which, when squared, are equal to the input.
Test cases
   Input (a, b, c, d)  =>  Output (a, b, c, d) rounded to 6 digits

 0.0,  1.0,  0.0,  0.0 =>  0.707107,  0.707107,  0.000000,  0.000000
 1.0,  1.0,  0.0,  0.0 =>  1.098684,  0.455090,  0.000000,  0.000000
 1.0, -1.0,  1.0,  0.0 =>  1.168771, -0.427800,  0.427800,  0.000000
 2.0,  0.0, -2.0, -1.0 =>  1.581139,  0.000000, -0.632456, -0.316228
 1.0,  1.0,  1.0,  1.0 =>  1.224745,  0.408248,  0.408248,  0.408248
 0.1,  0.2,  0.3,  0.4 =>  0.569088,  0.175720,  0.263580,  0.351439
99.0,  0.0,  0.0,  0.1 =>  9.949876,  0.000000,  0.000000,  0.005025

Generated using this Python script. Only one of the two correct answers is specified for each test case; the other is all four values negated.
Scoring & winning criterion
Standard code-golf rules apply. The shortest program or function in bytes in each language wins.

Can we take the quaternion as a, (b, c, d)?

@nwellnhof Sure. Even something like a,[b,[c,[d]]] is fine, if you can somehow save bytes with it :)

APL (NARS), 2 bytes
√
NARS has built-in support for quaternions. ¯\_(⍨)_/¯

I can't help it: you should include " ¯_(ツ)_/¯ " In your answer

You dropped this \

@Barranka Done.

@Andrew blame it on the Android app... Thank you for picking it up :)

It'd be better if it's ¯\_(⍨)√¯

Python 2, 72 bytes
def f(a,b,c,d):s=((a+(a*a+b*b+c*c+d*d)**.5)*2)**.5;print s/2,b/s,c/s,d/s

Try it online!
More or less a raw formula. I thought I could use list comprehensions to loop over b,c,d, but this seems to be longer. Python is really hurt here by a lack of vector operations, in particular scaling and norm.
Python 3, 77 bytes
def f(a,*l):r=a+sum(x*x for x in[a,*l])**.5;return[x/(r*2)**.5for x in[r,*l]]

Try it online!
Solving the quadratic directly was also shorter than using Python's complex-number square root to solve it like in the problem statement.

"Input is a non-real quaternion. You can take it as four real (floating-point) numbers, in any order and structure of your choice." So you can consider it to be a pandas series or numpy array. Series have scaling with simple multiplication, and there are various ways to get norm, such as (s*s).sum()**.5.

Wolfram Language (Mathematica), 19 bytes
Sqrt
<<Quaternions`

Try it online!
Mathematica has Quaternion built-in too, but is more verbose.

Although built-ins look cool, do upvote solutions that don't use built-ins too! I don't want votes on questions reaching HNQ be skewed.

JavaScript (ES7), 55 53 bytes
Based on the direct formula used by xnor.
Takes input as an array.
q=>q.map(v=>1/q?v/2/q:q=((v+Math.hypot(...q))/2)**.5)

Try it online!
How?
Given an array \$q=[a,b,c,d]\$, this computes:
$$x=\sqrt{\frac{a+\sqrt{a^2+b^2+c^2+d^2}}{2}}$$
And returns:
$$\left[x,\frac{b}{2x},\frac{c}{2x},\frac{d}{2x}\right]$$
q =>                            // q[] = input array
  q.map(v =>                    // for each value v in q[]:
    1 / q ?                     //   if q is numeric (2nd to 4th iteration):
      v / 2 / q                 //     yield v / 2q
    :                           //   else (1st iteration, with v = a):
      q = (                     //     compute x (as defined above) and store it in q
        (v + Math.hypot(...q))  //     we use Math.hypot(...q) to compute:
        / 2                     //       (q[0]**2 + q[1]**2 + q[2]**2 + q[3]**2) ** 0.5
      ) ** .5                   //     yield x
  )                             // end of map()

Haskell, 51 bytes
f(a:l)|r<-a+sqrt(sum$(^2)<$>a:l)=(/sqrt(r*2))<$>r:l

Try it online!
A direct formula. The main trick to express the real part of the output as r/sqrt(r*2) to parallel the imaginary part expression, which saves a few bytes over:
54 bytes
f(a:l)|s<-sqrt$2*(a+sqrt(sum$(^2)<$>a:l))=s/2:map(/s)l

Try it online!

Charcoal, 32 bytes
≔Ｘ⊗⁺§θ⁰ＸΣＥθ×ιι·⁵¦·⁵η≧∕ηθ§≔θ⁰⊘ηＩθ

Try it online! Link is to verbose version of code. Port of @xnor's Python answer. Explanation:
≔Ｘ⊗⁺§θ⁰ＸΣＥθ×ιι·⁵¦·⁵η

Square all of the elements of the input and take the sum, then take the square root. This calculates \$ | x + y\vec{u} | = \sqrt{ x^2 + y^2 } = \sqrt{ (a^2 - b^2)^2 + (2ab)^2 } = a^2 + b^2 \$. Adding \$ x \$ gives \$ 2a^2 \$ which is then doubled and square rooted to give \$ 2a \$.
≧∕ηθ

Because \$ y = 2ab \$, calculate \$ b \$ by dividing by \$ 2a \$.
§≔θ⁰⊘η

Set the first element of the array (i.e. the real part) to half of \$ 2a \$.
Ｉθ

Cast the values to string and implicitly print.

Java 8, 84 bytes
(a,b,c,d)->(a=Math.sqrt(2*(a+Math.sqrt(a*a+b*b+c*c+d*d))))/2+" "+b/a+" "+c/a+" "+d/a

Port of @xnor's Python 2 answer.
Try it online.
Explanation:
(a,b,c,d)->           // Method with four double parameters and String return-type
  (a=                 //  Change `a` to:
     Math.sqrt(       //   The square root of:
       2*             //    Two times:
         (a+          //     `a` plus,
          Math.sqrt(  //     the square-root of:
            a*a       //      `a`  squared,
            +b*b      //      `b` squared,
            +c*c      //      `c` squared,
            +d*d))))  //      And `d` squared summed together
  /2                  //  Then return this modified `a` divided by 2
  +" "+b/a            //  `b` divided by the modified `a`
  +" "+c/a            //  `c` divided by the modified `a`
  +" "+d/a            //  And `d` divided by the modified `a`, with space delimiters

05AB1E, 14 bytes
nOtsн+·t©/¦®;š

Port of @xnor's Python 2 answer.
Try it online or verify all test cases.
Explanation:
n                 # Square each number in the (implicit) input-list
 O                # Sum them
  t               # Take the square-root of that
   sн+            # Add the first item of the input-list
      ·           # Double it
       t          # Take the square-root of it
        ©         # Store it in the register (without popping)
         /        # Divide each value in the (implicit) input with it
          ¦       # Remove the first item
           ®;     # Push the value from the register again, and halve it
             š    # Prepend it to the list (and output implicitly)

Wolfram Language (Mathematica), 28 bytes
{s=#+Norm@{##},##2}/(2s)^.5&

Port of @xnor's Python 2 answer.
Try it online!

C# .NET, 88 bytes
(a,b,c,d)=>((a=System.Math.Sqrt(2*(a+System.Math.Sqrt(a*a+b*b+c*c+d*d))))/2,b/a,c/a,d/a)

Port of my Java 8 answer, but returns a Tuple instead of a String. I thought that would have been shorter, but unfortunately the Math.Sqrt require a System-import in C# .NET, ending up at 4 bytes longer instead of 10 bytes shorter.. >.>
The lambda declaration looks pretty funny, though:
System.Func<double, double, double, double, (double, double, double, double)> f =

Try it online.

Perl 6, 49 bytes
{;(*+@^b>>².sum**.5*i).sqrt.&{.re,(@b X/2*.re)}}

Try it online!
Curried function taking input as f(b,c,d)(a). Returns quaternion as a,(b,c,d).
Explanation
{;                                             }  # Block returning WhateverCode
     @^b>>².sum**.5     # Compute B of quaternion written as q = a + B*u
                        # (length of vector (b,c,d))
  (*+              *i)  # Complex number a + B*i
                      .sqrt  # Square root of complex number
                           .&{                }  # Return
                              .re,  # Real part of square root
                                  (@b X/2*.re)  # b,c,d divided by 2* real part


text:
Unminify a Pythlike String
Pyth is perhaps the most successful general-purpose golfing language. Though it is somewhat in decline as a result of newer languages, from 2014 to 2016 Pyth's concise syntax, constant updates, overloading, and (for its era) many builtins made it a favorite for the majority of questions.
Pyth code is often difficult to read. Even the output of the debug mode (transpiled Python) often consists of a long line, sometimes with parentheses nested ten deep. However, correctly formatted Pyth is very readable.
Here's a piece of Pyth code, written by @isaacg in Play the Word Chain.
.MlZfqhMtTeMPT+Lzs.pMyQ

It's much more readable like this.
.M                     Filter by gives-maximal-value of
   l Z                   lambda Z:length(Z) over
   f                     filter by (lambda T:
     q                     equal
       hM t T                head-map tail T
       eM P T                end-map Pop T)
     +L                    Append z to each element in
        z
        s .pM y Q            flattened permutations of each subset of Q

For this challenge, we eliminate the kolmogorov-complexity aspect of categorizing Pyth characters and focus on formatting. Instead of being Pyth code, the input will consist of characters in 0123456789M. The digit n represents a function of arity n, and M represents an operator. For example, the above code is represented as 210221M101M102M011M10. Here are the steps to unminify:
Separate the string into tokens.
A token matches [0-9]M*. 0M will not occur in input.
Add trailing 0s.
When there are not enough arguments, Pyth appends as many implicit variables (lambda variables or Qs) to the code as are necessary to fill the arguments of the program; these should be represented by 0s.
Group tokens into lines.
The arity of a token is the value of its digit.

An arity-0 token (i.e. a 0) ends a line.

For an arity-1 token the next token should go on the same line, separated by a space.

For an arity >=2 token, its arguments go on separate lines, in the order they appear in the code, each followed by their own subarguments and so on. Arguments to a token are indented to the end of that token plus one space.

Input
A nonempty string (or char array, array of length-1 strings, etc. as allowed by Standard I/O Methods) consisting of 0123456789M, which will not contain the substring 0M.
Output
The string formatted according to the above rules.
Test cases
210221M101M102M011M10

2
  1 0
  2
    2
      1M 1 0
      1M 1 0
    2M
       0
       1 1M 1 0

123M4M

1 2
    3M
       4M
          0
          0
          0
          0
       0
       0
    0

2MM

2MM
    0
    0

11011100

1 1 0
1 1 1 0
0

9000000

9
  0
  0
  0
  0
  0
  0
  0
  0
  0

Related question: https://codegolf.stackexchange.com/questions/47798/a-basic-pyth-like-syntax-checker

Can I take the input as an array of digits/string? Example 210221M101M102M011M10 would be [2,1,0,2,2,1,'M',1,0,1,'M',1,0,2,'M',0,1,1,'M',1,0]

@LuisfelipeDejesusMunoz No, unless standard I/O rules require that you be allowed to (which I don't think they do.) IMO it would slightly change the challenge if the Ms are allowed to be a different datatype from the integers.

@lirtosiast So an array of characters/single-character strings is fine, just not using different datatypes between digits and M?

@KamilDrakari Indeed.

What's the rule for the grammar of M?

@LeakyNun an M is always part of the preceding token, and doesn't change its arity.

What is the empty string to output?

@LeakyNun Empty string is now undefined behavior.

I don't understand, how many trailing 0s are added?

@Kyky As many as are required to fill missing arguments. An arity-k token requires k arguments and each token fills an argument. So if the end of your program has e.g. n 3s in a row, you need 2n 0s at the end.

Haskell, 192 190 187 bytes
unlines.snd.f
f(n:r)|(m,t)<-span(>'9')r,(s,l)<-n#t=(s,n?((n:m):map((' '<$(n:n:m))++)l))
f e=(e,["0"])
'1'?(a:b:r)=(a++drop(length a)b):r
_?s=s
'0'#s=(s,[])
n#s|(r,l)<-f s=(l++)<$>pred n#r

Try it online!
There has to be a better way to handle the arity-1 case, it currently takes up 45 bytes.
Edits:

-2 bytes by switching to a different method of handling 1, though the previous method has probably more optimization potential.
-3 bytes by not converting the character digits to numbers and using pred instead of n-1.

unlines.snd.f
f(n:r)|(m,t)<-span(>'9')r,(s,l)<-read[n]#t,w<-map((' '<$(n:n:m))++)=(s,last$((n:m):w l):[(n:m++' ':h):w t|n<'2',h:t<-[l]])
f e=(e,["0"])
0#s=(s,[])
n#s|(r,l)<-f s=(l++)<$>(n-1)#r

Try it online!

JavaScript (ES8), 160 159 bytes
f=(s,a=[d=0,p=[1]])=>s.replace(/(.)M*/g,(s,c)=>(g=_=>a[d]?s+(P=p[d]-=c--&&~s.length,c?`
`.padEnd(P):' '):g(d--))(a[d]--,a[++d]=+c,p[d]=p[d-1]))+(d?f('0',a):'')

Try it online!
Commented
f = (                          // f = recursive function taking:
  s,                           //   s   = input string
  a = [                        //   a[] = array holding the number of expected arguments
    d = 0,                     //   d   = current depth, initialized to 0
    p = [1]                    //   p[] = array holding the padding values
  ]                            //
) =>                           //
  s.replace(                   // search in s all substrings
    RegExp('(.)M*', 'g'),      // consisting of a digit followed by 0 to N 'M' characters
    (s, c) =>                  // for each substring s beginning with the digit c:
      ( g = _ =>               //   g = recursive function
          a[d] ?               //     if we're still expecting at least one argument at
                               //     this depth:
            s + (              //       append s
              P = p[d] -=      //       update the padding value P = p[d] for this depth:
                c-- &&         //         decrement c; unless c was equal to 0,
                ~s.length,     //         add the length of s + 1 to p[d]
              c ?              //       if c is not equal to 0 (i.e. was not equal to 1):
                `\n`.padEnd(P) //         append a linefeed followed by P - 1 spaces
              :                //       else:
                ' '            //         append a single space
            )                  //
          :                    //     else (all arguments have been processed):
            g(d--)             //       decrement the depth and call g again
      )(                       //   before the initial call to g:
        a[d]--,                //     decrement the number of arguments at depth d
        a[++d] = +c,           //     set the number of arguments for the next depth
        p[d] = p[d - 1]        //     set the padding value for the next depth,
      )                        //     using a copy of the previous depth
  ) + (                        // end of replace()
    d ?                        // if we're not back at depth 0:
      f('0', a)                //   do a recursive call to f with an extra '0'
    :                          // else:
      ''                       //   stop recursion
  )                            //

Charcoal, 75 bytes
ＦＳ⊞υ⎇⁼ιM⁺⊟υιι≔⮌υυ≔⟦⟧θ≔⟦⟧ηＷ∨υη«≔⎇υ⊟υ0ιι¿⊖Σι↘→⊞θι⊞ηΣιＷ∧η¬§η±¹«⊟ηＭ⊕Ｌ⊟θ←¿η⊞η⊖⊟η

Try it online! Link is to verbose version of code. Explanation:
ＦＳ⊞υ⎇⁼ιM⁺⊟υιι

Loop over the input characters and turn them into a list of digits with optional M suffixes.
≔⮌υυ

Reverse this list so that we can use Pop to consume it.
≔⟦⟧θ

This variable is a stack of tokens whose arity has not yet been fulfilled.
≔⟦⟧η

This variable is a stack of the remaining arity of the unfulfilled tokens.
Ｗ∨υη«

Repeat until we have consumed all of the tokens and emptied the stack.
     ≔⎇υ⊟υ0ι

Get the next token or 0 if none.
     ι¿⊖Σι↘→

Print the token and then move the cursor horizontally if it begins with 1 otherwise diagonally.
     ⊞θι⊞ηΣι

Add the token and its arity to the appropriate variables.
     Ｗ∧η¬§η±¹«

Repeat while the arity stack is nonempty but the top arity is zero.
              ⊟η

Discard the zero arity.
              Ｍ⊕Ｌ⊟θ←

Remove its token and move that many characters left.
              ¿η⊞η⊖⊟η

If there are any arities left then decrement the top arity.