Skip to main content
deleted 572 characters in body
Source Link
Julian
  • 3.2k
  • 7
  • 17

PowerShell Core, 9999 69 bytes

for($a=$args;"$a"$a=$args)|%{"$s$a"
$u=$n
for($i=0;$a.Count-$i-1)$a=$a|%{$u+=,(($a[$i]+$a[++$i])%10$p+$_)%10;$p=$_}
$a=$u|select -skip 1
$s+=" "}

Try it online!Try it online!

Explanations

for($a=$args;"$a"){"$s$a"
          # ^ Assigns the function arguments to a shorter variable.
          # ^ While the list as string is not empty
          # ^ Output the list, space separated, prefixed by the required numbers of spaces
$u=$n     # Sets the updated array to null
for($i=0;$a.Count-$i-1){$u+=,(($a[$i]+$a[++$i])%10)}
          # ^ for each pair of numbers in $a, sum them, mod 10, and append them to the updated array
$a=$u     # Replaces $a with $u
$s+=" "}  # Increases the numbers of spaces that needs to be prepended

-99 bytes thanks to @mazzy !

PowerShell Core, 99 bytes

for($a=$args;"$a"){"$s$a"
$u=$n
for($i=0;$a.Count-$i-1){$u+=,(($a[$i]+$a[++$i])%10)}
$a=$u
$s+=" "}

Try it online!

Explanations

for($a=$args;"$a"){"$s$a"
          # ^ Assigns the function arguments to a shorter variable.
          # ^ While the list as string is not empty
          # ^ Output the list, space separated, prefixed by the required numbers of spaces
$u=$n     # Sets the updated array to null
for($i=0;$a.Count-$i-1){$u+=,(($a[$i]+$a[++$i])%10)}
          # ^ for each pair of numbers in $a, sum them, mod 10, and append them to the updated array
$a=$u     # Replaces $a with $u
$s+=" "}  # Increases the numbers of spaces that needs to be prepended

PowerShell Core, 99 69 bytes

($a=$args)|%{"$s$a"
$a=$a|%{($p+$_)%10;$p=$_}|select -skip 1
$s+=" "}

Try it online!

-99 bytes thanks to @mazzy !

Source Link
Julian
  • 3.2k
  • 7
  • 17

PowerShell Core, 99 bytes

for($a=$args;"$a"){"$s$a"
$u=$n
for($i=0;$a.Count-$i-1){$u+=,(($a[$i]+$a[++$i])%10)}
$a=$u
$s+=" "}

Try it online!

Explanations

for($a=$args;"$a"){"$s$a"
          # ^ Assigns the function arguments to a shorter variable.
          # ^ While the list as string is not empty
          # ^ Output the list, space separated, prefixed by the required numbers of spaces
$u=$n     # Sets the updated array to null
for($i=0;$a.Count-$i-1){$u+=,(($a[$i]+$a[++$i])%10)}
          # ^ for each pair of numbers in $a, sum them, mod 10, and append them to the updated array
$a=$u     # Replaces $a with $u
$s+=" "}  # Increases the numbers of spaces that needs to be prepended