Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Thanks @H.PWiz for -2 bytes!
-2
Σ∫
Try it online!
Σ -- sum all ∫ -- prefix sums
Thanks @H.PWiz for -12 bytebytes!
-12
Σ∫dΣ∫
Try it online!Try it online!
Thanks @H.PWiz for -1 byte!
-1
Σ∫d
ṁΣḣd
Actually ΣΣḣd would work too, then the secondThanks @H.PWiz for Σ-1 would join the list.byte!
ΣΣḣd
Σ-1
d -- convert N to list of digits ḣ -- list with all prefixes ṁ -- map and sum the result Σ -- sumΣ∫d
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