Skip to content

Instantly share code, notes, and snippets.

@keck
Created March 9, 2015 15:27
Show Gist options
  • Save keck/2c6a04fa22fc9de6a64d to your computer and use it in GitHub Desktop.
Save keck/2c6a04fa22fc9de6a64d to your computer and use it in GitHub Desktop.
# https://twitter.com/mjdominus/status/574937856298369024
# What is the biggest five digit number ABCDE that is divisible by BCDE, CDE, DE and E?
use strict;
for (my $i = 99999; $i>9999; $i--){
map {
my $div = join '', (split '', $i)[$_ .. 4];
next if ($div == 0 ) || ( $i % $div );
} 1 .. 4;
print "$i\n";
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment