← RoseCode

ROSECODE 559

Balanced numbers revisited

C_K_Yang · Programming ·

A positive integer with k (decimal) digits is called balanced if its first ⌈k2⌉ digits sum to the same value as its last ⌈k2⌉ digits, where ⌈x⌉, pronounced ceiling of x, is the smallest integer ≥ x, thus ⌈π⌉=4 and ⌈5⌉=5.

For example, 77, 101, 13722, and 585774 are balanced numbers.

Find the number and the sum of all balanced numbers n for 0<n≤111111 and give your answer modulo 1000000007

Answer format: count,sum(both modulo 1000000007)

You are given: 634521,744405873 for a threshold of 12345678


[My timing: 1 s]