Enumerate sandwich numbers

Exactly like in the exercise "Sandwich numbers", we define a sandwich
number as a natural number n with only two different digits d and e that
are repeated in the form de₁e₂⋯e_(k)d, with k ≥ 1.

Write a program that displays all the sandwich numbers of X digits on
the screen.

Input

The input consists of a natural number X, with 3 ≤ X ≤ 9.

Output

A list of sandwich numbers of X digits, one per line. The numbers can be
written in any order. You can generate the numbers as you wish, either
as integers or character by character.

Problem information

Author: PRO1

Generation: 2026-01-25T21:36:33.218Z

© Jutge.org, 2006–2026.
https://jutge.org
