Skip to main content
striked through 4 is still 4...
Source Link
ბიმო
  • 16.9k
  • 2
  • 41
  • 104

Husk, 4 2 bytes

Thanks @H.PWiz for -2 bytes!

Σ∫

Try it online!

"Ungolfed"/Explained

Σ    -- sum all
 ∫   -- prefix sums

Husk, 4 2 bytes

Thanks @H.PWiz for -2 bytes!

Σ∫

Try it online!

"Ungolfed"/Explained

Σ    -- sum all
 ∫   -- prefix sums

Husk, 2 bytes

Thanks @H.PWiz for -2 bytes!

Σ∫

Try it online!

"Ungolfed"/Explained

Σ    -- sum all
 ∫   -- prefix sums
-1
Source Link
ბიმო
  • 16.9k
  • 2
  • 41
  • 104

Husk, 4 32 bytes

Thanks @H.PWiz for -12 bytebytes!

Σ∫dΣ∫

Try it online!Try it online!

"Ungolfed"/Explained

Σ    -- sum all
 ∫   -- prefix sums

Husk, 4 3 bytes

Thanks @H.PWiz for -1 byte!

Σ∫d

Try it online!

Husk, 4 2 bytes

Thanks @H.PWiz for -2 bytes!

Σ∫

Try it online!

"Ungolfed"/Explained

Σ    -- sum all
 ∫   -- prefix sums
-1
Source Link
ბიმო
  • 16.9k
  • 2
  • 41
  • 104

Husk, 44 3 bytes

ṁΣḣd

Try it online!

Explanation/Ungolfed

Actually ΣΣḣd would work too, then the secondThanks @H.PWiz for Σ-1 would join the list.byte!

   d -- convert N to list of digits
  ḣ  -- list with all prefixes
ṁ    -- map and sum the result
 Σ   -- sumΣ∫d

Try it online!

Husk, 4 bytes

ṁΣḣd

Try it online!

Explanation/Ungolfed

Actually ΣΣḣd would work too, then the second Σ would join the list.

   d -- convert N to list of digits
  ḣ  -- list with all prefixes
ṁ    -- map and sum the result
 Σ   -- sum

Husk, 4 3 bytes

Thanks @H.PWiz for -1 byte!

Σ∫d

Try it online!

Source Link
ბიმო
  • 16.9k
  • 2
  • 41
  • 104
Loading