Sum in 2540 sums

Haskell, 25 bytes

b~zw=sum(fromEnum`map`zw)

Try it online!

The ~ is not an infix operator, but a marker for a lazy pattern match on argument zw of b, while conveniently being the largest-valued ASCII character at 126. The infix-ized `map` is also used because the backtick has a large ASCII value of 96. With both of these, we can avoid any spaces or other whitespace, which have low ASCII values.

The dense 24-byter

z~zz=sum$fromEnum`map`zz

comes just short in its sum of 2525, 15 too small. Its average ASCII value is 105.21, with the only values below 97 (for a) being = at 61, $ at 36, and E at 69. An improvement would like involve finding an alternative for one of these.

(Non-ASCII characters can surely do better by having higher character values, but I'm not doing that because this is more interesting.)


Python 3, 11 10 9 bytes

Thanks @MariaMiller for finding the right Unicode character, saving 1 byte!

ࠂ,=sum,

Try it online!

This is essentially just sum, padded with extra characters to reach the sum of 2540. Usage is ࠂ(s) where s is a byte string (which acts like both string and integer array). Feels kinda cheaty, but ¯\_(ツ)_/¯.

The first character in source code is the Unicode character with codepoint 2050 (Samaritan letter Gaman). This character might not be displayable depending on your browser.


The previous solution is longer but has nice Unicode characters:

11 bytes

ϕ,ϴ=sum,9

Try it online!


Brain-Flak, 32 bytes

<[[[{({}()<>)<>}<>({{}[()]})]]]>

Try it online!

Explanation

First the observations I made my first time around (that solution and its explanation is below) continue to be important here. We need and even number of () pairs for a valid answer.

This time however we are going to use a starting program that already has an even number of ()s.

{({}()<>)<>}<>({{}[()]})

This program first increments every element by 1 then calculates the sum of 1 less than every element. If we look at all possible ways to delete from this without causing a bracket mismatch here are what they do:

{(()<>)<>}<>({{}[()]}) # Never halts
{({}<>)<>}<>({{}[()]}) # Sums 1 less than every element
{({}())<>}<>({{}[()]}) # One more than above
{({}()<>)}<>({{}[()]}) # Never halts
{({}()<>)<>}({{}[()]}) # No output
{({}()<>)<>}<>({[()]}) # Never halts
{({}()<>)<>}<>({{}[]}) # Complex output still incorrect
{(<>)<>}<>({{}[()]})   # Never halts
{({})<>}<>({{}[()]})   # Sums 1 less than every element
{({}()<>)<>}<>({{}})   # Sums 1 more than every element
{()<>}<>({{}[()]})     # Sums 1 less than every element
{({}()<>)<>}<>({})     # Adds 1 to every element
{<>}<>({{}[()]})       # Sums 1 less than every element
{({}()<>)<>}<>()       # Adds 1 to every element
{}<>({{}[()]})         # Outputs 0
{({}()<>)<>}<>         # Adds 1 to every element
<>({{}[()]})           # Outputs 0
{({}()<>)<>}           # Outputs nothing
({{}[()]})             # Sums 1 less than every element

So this is a good starting place. To make it the correct sum I use the same method I outlined for the first attempt.

Now we just need the proper combination of [..]s <..>s and ((..){}){}s to hit 2540. Unfortunately while [..]s would be ideal seeing as they have the highest codepoint average I can't seem to get it to work with any of them present.

This time we are luckier and the winning combination is <[[[..]]]>.

Brain-Flak, 34 bytes

<<<<<<<<(((({{}})){}){}){}>>>>>>>>

Try it online!

Explanation

The code that does the task is ({{}}). But we need to pad it to 2540. The main issue is that apart from () every pair has an even total. This means we need and even number of () pairs, and at the same time our starting code uses only 1 () pair.

On top of this unlike [] or <> () pairs are not so easy to add. The one way we can do that is to wrap the entire program in (..){}, so to rectify our issue we alter the base program to

(({{}})){}

Now we just need the proper combination of [..]s <..>s and ((..){}){}s to hit 2540. Unfortunately while [..]s would be ideal seeing as they have the highest codepoint average I can't seem to get it to work with any of them present. The one that works is the one used above.