#P1206. Palindromic Squares

    ID: 14167 Type: Default 1000ms 256MiB

Palindromic Squares

Palindromic Squares

A palindromic number is a number that reads the same forward and backward. For example, \(12321\) is a typical palindromic number.

Given a positive integer \(B\) (in decimal), your task is to output all numbers \(n\) in the range \([1, 300]\) such that the representation of \(n^2\) in base \(B\) is a palindrome. The conversion to base \(B\) should use digits \(0-9\) and uppercase letters for values beyond 9 (e.g. \(10\) is represented as A).

inputFormat

The input consists of a single line containing a positive integer \(B\) in decimal.

outputFormat

Output each number \(n\) (one per line) from \(1\) to \(300\) for which the representation of \(n^2\) in base \(B\) is a palindrome.

sample

10
1

2 3 11 22 26 101 111 121 202 212 264

</p>