Created
January 27, 2012 18:20
-
-
Save asolkar/1690138 to your computer and use it in GitHub Desktop.
Beauty of Math! (https://plus.google.com/u/0/102786751626732213960/posts/PvZKGwZ3kLQ)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
# | |
# Beauty of Math! | |
# https://plus.google.com/u/0/102786751626732213960/posts/PvZKGwZ3kLQ | |
# | |
print join ("\n\n", | |
( | |
join ("\n", | |
map { $_ = sprintf("%25s", $_) . " = " . eval ($_) } | |
map { $_ = join('', (1..$_)) . " * 8 + $_" } (1..9)), | |
join ("\n", | |
map { $_ = sprintf("%25s", $_) . " = " . eval ($_) } | |
map { $_ = join('', (1..$_)) . " * 9 + " . ($_+1) } (1..9)), | |
join ("\n", | |
map { $_ = sprintf("%25s", $_) . " = " . eval ($_) } | |
map { $_ = join('', sort {$b <=> $a}($_..9)) . " * 9 + " . ($_-2) } | |
(sort {$b <=> $a} (2..9))), | |
join ("\n", | |
map { $_ = sprintf("%25s", $_) . " = " . eval ($_) } | |
map { $_ = ("1"x$_) . " * " . ("1"x$_) } (1..9)), | |
)) . "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 * 8 + 1 = 9 | |
12 * 8 + 2 = 98 | |
123 * 8 + 3 = 987 | |
1234 * 8 + 4 = 9876 | |
12345 * 8 + 5 = 98765 | |
123456 * 8 + 6 = 987654 | |
1234567 * 8 + 7 = 9876543 | |
12345678 * 8 + 8 = 98765432 | |
123456789 * 8 + 9 = 987654321 | |
1 * 9 + 2 = 11 | |
12 * 9 + 3 = 111 | |
123 * 9 + 4 = 1111 | |
1234 * 9 + 5 = 11111 | |
12345 * 9 + 6 = 111111 | |
123456 * 9 + 7 = 1111111 | |
1234567 * 9 + 8 = 11111111 | |
12345678 * 9 + 9 = 111111111 | |
123456789 * 9 + 10 = 1111111111 | |
9 * 9 + 7 = 88 | |
98 * 9 + 6 = 888 | |
987 * 9 + 5 = 8888 | |
9876 * 9 + 4 = 88888 | |
98765 * 9 + 3 = 888888 | |
987654 * 9 + 2 = 8888888 | |
9876543 * 9 + 1 = 88888888 | |
98765432 * 9 + 0 = 888888888 | |
1 * 1 = 1 | |
11 * 11 = 121 | |
111 * 111 = 12321 | |
1111 * 1111 = 1234321 | |
11111 * 11111 = 123454321 | |
111111 * 111111 = 12345654321 | |
1111111 * 1111111 = 1234567654321 | |
11111111 * 11111111 = 123456787654321 | |
111111111 * 111111111 = 12345678987654321 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment