Balanced number (source code)

= Balanced number

A <positive integer> whose first $\lceil k/2\rceil$ decimal <numerical digits> have the same sum as its last $\lceil k/2\rceil$ digits, where $k$ is the number of digits. For odd $k$, the shared middle digit cancels from the equality. Counts and value sums can therefore be assembled from two half-length <digit dynamic programming> tables indexed by <base-p digit sum>.