0% found this document useful (0 votes)
22 views1 page

Quirksome Squares: Input

The document describes "quirksome numbers", which have the property that splitting the decimal representation into two equal strings and squaring their sum returns the original number. The problem is to find all quirksome numbers with a given even number of digits. The input will specify the number of digits, and the output should list the quirksome numbers for each input size in increasing order, including leading zeros.

Uploaded by

Hello mister
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

Quirksome Squares: Input

The document describes "quirksome numbers", which have the property that splitting the decimal representation into two equal strings and squaring their sum returns the original number. The problem is to find all quirksome numbers with a given even number of digits. The input will specify the number of digits, and the output should list the quirksome numbers for each input size in increasing order, including leading zeros.

Uploaded by

Hello mister
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

256 Quirksome Squares

The number 3025 has a remarkable quirk: if you split its decimal representation in two strings of equal
length (30 and 25) and square the sum of the numbers so obtained, you obtain the original number:

(30 + 25)2 = 3025


The problem is to determine all numbers with this property having a given even number of digits.
For example, 4-digit numbers run from 0000 to 9999. Note that leading zeroes should be taken
into account. This means that 0001 which is equal to (00 + 01)2 is a quirksome number of 4 digits.
The number of digits may be 2,4,6 or 8. Although maxint is only 32767 and numbers of eight digits
are asked for, a well-versed programmer can keep his numbers in the range of the integers. However
efficiency should be given a thought.

Input
The input of your program is a textflle containing numbers of digits (taken from 2,4,6,8), each number
on a line of its own.

Output
The output is a textfile consisting of lines containing the quirksome numbers (ordered according to the
input numbers and for each input number in increasing order).
Warning: Please note that the number of digits in the output is equal to the number in the corre-
sponding input line : leading zeroes may not be suppressed.

Sample Input
2
2

Sample Output
00
01
81
00
01
81

You might also like