← Complete problem index

PROJECT EULER · #1004

Balanced Integer

Statement only · UnsolvedOriginal problem ↗

A positive integer is called balanced if the size of its longest strictly decreasing subsequence (in its decimal expression) is the same as the size of its longest non-strictly increasing subsequence.

For example, the number 77429 is balanced, because both its longest strictly decreasing subsequence (742) and its longest non-strictly increasing subsequence (779) have length 3.

There are 2274 balanced integers below 104.

Find the total number of balanced integers. Give your answer modulo 109+7.

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.