Created
March 26, 2023 11:09
-
-
Save sdennler/cd2f034f11cfd26bb71572007ff38a0b to your computer and use it in GitHub Desktop.
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
<?php | |
$l = range('A', 'I'); | |
for($i=123456789; $i<=987654321; $i++){ | |
$a = str_split((string)$i); | |
if(9 <> count(array_unique($a))) continue; | |
if(in_array('0', $a)) continue; | |
$a = array_combine($l, $a); | |
if($a['A'] - $a['B'] != $a['C']) continue; | |
if($a['A'] + $a['B'] != $a['D']) continue; | |
if($a['B'] * $a['E'] != $a['F']) continue; | |
if($a['G'] - $a['H'] != $a['I'] / $a['B']) continue; | |
echo "ABCDEFGHI\n$i\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment