← Complete problem index

PROJECT EULER · #0558

Irrational Base

Statement only · UnsolvedOriginal problem ↗

Let r be the real root of the equation x3=x2+1.
Every positive integer can be written as the sum of distinct increasing powers of r.
If we require the number of terms to be finite and the difference between any two exponents to be three or more, then the representation is unique.
For example, 3=r10+r5+r1+r2 and 10=r10+r7+r6.
Interestingly, the relation holds for the complex roots of the equation.

Let w(n) be the number of terms in this unique representation of n. Thus w(3)=4 and w(10)=3.

More formally, for all positive integers n, we have:
n=k=bkrk
under the conditions that:
bk is 0 or 1 for all k;
bk+bk+1+bk+21 for all k;
w(n)=k=bk is finite.

Let S(m)=j=1mw(j2).
You are given S(10)=61 and S(1000)=19403.

Find S(5000000).

Write-up coming later

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