2018-09-30 22:01:58 +00:00
---
id: 5900f4461000cf542c50ff58
title: 'Problem 217: Balanced Numbers'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 301859
2021-01-13 02:31:00 +00:00
dashedName: problem-217-balanced-numbers
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2021-07-15 07:20:31 +00:00
A positive integer with $k$ (decimal) digits is called balanced if its first $⌈\frac{k}{2}⌉$ digits sum to the same value as its last $⌈\frac{k}{2}⌉$ digits, where $⌈x⌉$, pronounced ceiling of $x$, is the smallest integer $≥ x$, thus $⌈π⌉ = 4$ and $⌈5⌉ = 5$.
2020-11-27 18:02:05 +00:00
2018-09-30 22:01:58 +00:00
So, for example, all palindromes are balanced, as is 13722.
2020-11-27 18:02:05 +00:00
2021-07-15 07:20:31 +00:00
Let $T(n)$ be the sum of all balanced numbers less than $10^n$.
2018-09-30 22:01:58 +00:00
2021-07-15 07:20:31 +00:00
Thus: $T(1) = 45$, $T(2) = 540$ and $T(5) = 334\\,795\\,890$.
2018-09-30 22:01:58 +00:00
2021-07-15 07:20:31 +00:00
Find $T(47)\\,mod\\,3^{15}$
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2021-07-15 07:20:31 +00:00
`balancedNumbers()` should return `6273134` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-15 07:20:31 +00:00
assert.strictEqual(balancedNumbers(), 6273134);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
2021-07-15 07:20:31 +00:00
function balancedNumbers() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-15 07:20:31 +00:00
balancedNumbers();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```