-5 bytes (and even slower than before 😅) thanks to @CommandMaster.
∞Óʒ¹*OQ}ε2£Æ
Two separated inputs \$[upvoteRep,downvoteRep]\$ and \$totalRep\$.
Outputs an infinite list that includes duplicated items.
Try it online. (Extremely slow brute-force that barely outputs the first two unique terms of the example test case, so no test suite with all test cases.)
We can prevent the duplicated items for +2 bytes by adding a trailing }Ù
:
Try it online.
Earlier 14 bytes answer (partially also by @CommandMaster) that's a lot faster:
∞Ý€ã€`ʒ¹*OQ}€Æ
Similar I/O as above.
Try it online.
We can prevent the duplicated items for +1 byte this time by adding a trailing Ù
:
Try it online or verify the first five values of all test cases.
Explanation:
∞ # Push an infinite list of positive integers: [1,2,3,...]
Ó # Convert each to a list of exponents of its prime factorization:
# [[],[1],[0,1],[2],[0,0,1],[1,1],[0,0,0,1],[3],[0,2],[1,0,1],...]
ʒ¹*OQ} # Only keep all valid lists for the given inputs:
ʒ } # Filter this infinite list of lists by:
¹* # Multiply the first two values in the list by the first input-pair of
# [pos,neg] (or if it's a singleton list, multiply its value by just `pos`)
O # Sum this pair (or singleton)
Q # Check whether it's equal to the second (implicit) input-integer
ε2£Æ # Calculate the question-scores of the remaining valid lists:
ε # Map over each remaining list in the infinite list:
2£ # Only keep (up to) the first 2 values
Æ # Reduce it by subtracting: [a,b]→a-b or [a]→a
}Ù # (optional) Close the map, and uniquify this infinite list of values
# (after which the infinite list of scores is output implicitly as result)
∞Ý€ã€` # Generate an infinite list of non-negative pairs:
∞ # Push an infinite list of positive integers: [1,2,3,...]
Ý # Convert each value to a [0,v]-ranged list: [[0,1],[0,1,2],[0,1,2,3],...]
ۋ # Map over each list, and get its cartesian power of 2 to create pairs:
# [[[0,0],[0,1],[1,0],[1,1]],[[0,0],[0,1],[0,2],[1,0],...],...]
€` # Flatten the list of lists of pairs one level down:
# [[1,1],[1,0],[0,1],[0,0],[2,2],[2,1],[2,0],[1,2],[1,1],[1,0],...]
ʒ¹*OQ} # Only keep all valid pairs for the given inputs:
ʒ } # Filter this infinite list of pairs by:
¹* # Multiply the values in the pair by the first input-pair of [pos,neg]
O # Sum the values in this pair together
Q # Check whether it's equal to the second (implicit) input-integer
ۮ # Calculate the question-scores of the remaining valid pairs:
€ # Map over each remaining pair in the infinite list:
Æ # Reduce the pair by subtracting: [a,b]→a-b
Ù # (optional) Uniquify this infinite list of values
# (after which the infinite list of scores is output implicitly as result)