Write a simple bash script that solves the following:
For all 4 digit integers, such as 1234, divide it in the middle to get two 2 digit numbers 12 & 34
Add the two 2 digit numbers
square the sum
the result is the original 4 digit number and the square of the sum are equal.
print out all of the four digit numbers for which this is true.
BTW 1234 is not one of these numbers, I just used it for an example
To make the syntax correct, the file must begin with
and end with
DO NOT print your resulting script here on the forum. Let’s give everyone who wishes to participate a chance.
Message me with your script listing, I will try it and if it passes the test I will add your name to the following list in this Original Post.
➜ time python numbers.py
python numbers.py 0.07s user 0.01s system 98% cpu 0.082 total
➜ time sh ./numbers.sh
sh ./numbers.sh 33.80s user 21.93s system 731% cpu 7.623 total
➜ time perl numbers.pl
perl numbers.pl 0.01s user 0.01s system 96% cpu 0.019 total