Various incomplete solutions
This commit is contained in:
10
ProjectEuler/032/desc.yml
Normal file
10
ProjectEuler/032/desc.yml
Normal file
@ -0,0 +1,10 @@
|
||||
title: Find the sum of all numbers that can be written as pandigital products.
|
||||
url: http://projecteuler.net/problem=32
|
||||
|
||||
desc: |
|
||||
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.
|
||||
The product 7254 is unusual, as the identity, 39 x 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.
|
||||
Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.
|
||||
HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.
|
||||
solution: Bruteforce
|
||||
|
6
ProjectEuler/032/solve.php
Normal file
6
ProjectEuler/032/solve.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
function pandigital($number) {
|
||||
$array = count_chars($number,1);
|
||||
ksort($array);
|
||||
if($array == array(49=>1,50=>1,51=>1,52=>1,53=>1,54=>1,55=>1,56=>1,57=>1)) { return true;} else { return false; }
|
||||
}
|
Reference in New Issue
Block a user