MathsReadCompetitive mathematics
Pattern recognition · integer answermedium7 min

Palindromic ends

Digit Patterns

A display shows palindromes made of ones: 1,11,111,1111,... . How many digits are printed altogether when the first 40 displayed palindromes are written consecutively? Submit one integer.

Learning goal: Count each palindrome length.

Look for the underlying structure rather than guessing the next number. Submit only the final integer; you can open hints below as needed.

Check your answer without signing in. Sign in to save your progress.

Accepted format: a whole number such as 42 or 123456789. No commas, formulas, or source code.

Hints

Hint 1

The kth palindrome contains k digits.

Hint 2

Add lengths 1+2+...+40.

Hint 3

Use a triangular-number formula.

Common mistake to avoid

Assuming the first visible step stays constant without testing the full pattern.

How to approach this problem

Although the displayed integers grow rapidly, each successive palindrome adds only one to its length. Sum the lengths rather than the numeric values.

Worked example with different values

The first six strings of ones have total length 1+2+3+4+5+6=21.

Apply the same reasoning to the challenge. This example is a separate practice problem.

Learn the technique: Sequence patterns: differences, recurrences and interleaving

Report a question or explanation issue

Sequence patterns · Repeating remainders

Back to problems →