Skip to content

Instantly share code, notes, and snippets.

@uestla
Last active November 18, 2018 10:22
Show Gist options
  • Save uestla/893c94b5d22b7e417c4e1af4ee7e7c98 to your computer and use it in GitHub Desktop.
Save uestla/893c94b5d22b7e417c4e1af4ee7e7c98 to your computer and use it in GitHub Desktop.
<?php
$counter = 0;
for ($i = 0; $i <= 2359; $i++) {
$n = str_pad($i, 4, '0', STR_PAD_LEFT);
$ciphers = str_split($n);
if ($ciphers[2] > 5) {
continue ;
}
sort($ciphers);
for ($j = 0; $j < 3; $j++) {
if (($ciphers[$j + 1] - $ciphers[$j]) !== 1) { // not incremental ciphers -> skip entire number
continue 2;
}
}
echo $n, "\n";
$counter++;
}
echo "\n", $counter, "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment