#B4276. Palindrome Octal Squares
Palindrome Octal Squares
Palindrome Octal Squares
Given a positive decimal integer \(N\) (\(1 \le N \le 10^9\)), output all the numbers between \(1\) and \(N\) (inclusive) that meet the following requirements:
- The octal representation of the number is a palindrome.
- The number is a perfect square.
Example: For \(N=20\), the valid numbers in the range are \(1\), \(4\), and \(9\) because:
- \(1\) in octal is "1", which is a palindrome, and \(1 = 1^2\).
- \(4\) in octal is "4", which is a palindrome, and \(4 = 2^2\).
- \(9\) in octal is "11", which is a palindrome, and \(9 = 3^2\).
Output format: The numbers should be printed in increasing order, separated by a single space.
inputFormat
A single line containing a positive integer (N).
outputFormat
A single line containing the valid numbers separated by spaces.
sample
20
1 4 9