← Complete problem index

PROJECT EULER · #0943

Self Describing Sequences

Statement only · UnsolvedOriginal problem ↗

Given two unequal positive integers a and b, we define a self-describing sequence consisting of alternating runs of as and bs. The first element is a and the sequence of run lengths is the original sequence.

For a=2,b=3, the sequence is: 2,2,3,3,2,2,2,3,3,3,2,2,3,3,2,2,3,3,3,2,2,2,3,3,3,... The sequence begins with two 2s and two 3s, then three 2s and three 3s, so the run lengths 2,2,3,3,... are given by the original sequence.

Let T(a,b,N) be the sum of the first N elements of the sequence. You are given T(2,3,10)=25, T(4,2,104)=30004, T(5,8,106)=6499871.

Find T(a,b,22332223332233) for 2a223, 2b223 and ab. Give your answer modulo 2233222333.

Write-up coming later

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