Cody

# Problem 1825. Find all vampire fangs

Solution 1943959

Submitted on 20 Sep 2019 by Ed P.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 125460; factors = vampire_factor(x); correct_factors = [204 615; 246 510]; assert(isequal(factors,correct_factors))

temp = '125460' xy = '153820' contain_xy = 1×6 logical array 1 1 0 0 1 1 fang_check = 1×6 logical array 1 1 1 0 1 0 temp = '125460' xy = '164765' contain_xy = 1×6 logical array 1 1 1 0 1 1 fang_check = 1×6 logical array 0 0 0 0 0 0 temp = '125460' xy = '170738' contain_xy = 1×6 logical array 1 0 1 0 0 0 fang_check = 1×6 logical array 1 1 0 0 0 0 temp = '125460' xy = '180697' contain_xy = 1×6 logical array 1 0 1 1 0 0 fang_check = 1×6 logical array 1 1 0 0 0 0 temp = '125460' xy = '204615' contain_xy = 1×6 logical array 1 1 1 1 1 1 fang_check = 1×6 logical array 1 1 1 1 1 1 temp = '125460' xy = '205612' contain_xy = 1×6 logical array 1 1 1 1 1 1 fang_check = 1×6 logical array 1 1 1 0 1 1 temp = '125460' xy = '246510' contain_xy = 1×6 logical array 1 1 1 1 1 1 fang_check = 1×6 logical array 1 1 1 1 1 1 temp = '125460' xy = '255492' contain_xy = 1×6 logical array 1 1 1 1 0 1 fang_check = 1×6 logical array 0 0 0 0 1 0 temp = '125460' xy = '306410' contain_xy = 1×6 logical array 0 1 1 1 1 1 fang_check = 1×6 logical array 1 0 0 0 0 1 temp = '125460' xy = '340369' contain_xy = 1×6 logical array 0 1 1 0 1 0 fang_check = 1×6 logical array 1 0 0 1 0 0 temp = '125460' xy = '369340' contain_xy = 1×6 logical array 0 1 0 0 1 1 fang_check = 1×6 logical array 1 0 0 1 0 0 temp = '125460' xy = '410306' contain_xy = 1×6 logical array 1 1 1 0 1 1 fang_check = 1×6 logical array 1 0 0 0 0 1 temp = '125460' xy = '492255' contain_xy = 1×6 logical array 1 0 1 1 1 1 fang_check = 1×6 logical array 0 0 0 0 1 0 temp = '125460' xy = '612205' contain_xy = 1×6 logical array 1 1 1 1 1 1 fang_check = 1×6 logical array 1 1 1 0 1 1 temp = '125460' xy = '697180' contain_xy = 1×6 logical array 1 0 0 1 0 1 fang_check = 1×6 logical array 1 1 0 0 0 0 temp = '125460' xy = '738170' contain_xy = 1×6 logical array 0 0 0 1 0 1 fang_check = 1×6 logical array 1 1 0 0 0 0 temp = '125460' xy = '765164' contain_xy = 1×6 logical array 0 1 1 1 1 1 fang_check = 1×6 logical array 0 0 0 0 0 0 temp = '125460' xy = '820153' contain_xy = 1×6 logical array 0 1 1 1 1 0 fang_check = 1×6 logical array 1 1 1 0 1 0

2   Pass
x = 1827; factors = vampire_factor(x); correct_factors = [21 87]; assert(isequal(factors,correct_factors))

temp = '1827' xy = '2187' contain_xy = 1×4 logical array 1 1 1 1 fang_check = 1×4 logical array 1 1 1 1 temp = '1827' xy = '2963' contain_xy = 1×4 logical array 1 0 0 0 fang_check = 1×4 logical array 0 0 0 0 temp = '1827' xy = '6329' contain_xy = 1×4 logical array 0 0 1 0 fang_check = 1×4 logical array 0 0 0 0

3   Pass
x = 100; factors = vampire_factor(x); correct_factors = []; assert(isequal(factors,correct_factors))

4   Pass
x = 13078260; factors = vampire_factor(x); correct_factors = [1620 8073; 1863 7020; 2070 6318]; assert(isequal(factors,correct_factors))

temp = '13078260' xy = '13809477' contain_xy = 1×8 logical array 1 1 1 1 0 0 1 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '14049315' contain_xy = 1×8 logical array 1 0 1 0 0 1 1 0 fang_check = 1×8 logical array 1 0 1 0 0 0 0 0 temp = '13078260' xy = '14588970' contain_xy = 1×8 logical array 1 0 0 1 1 0 1 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '14958748' contain_xy = 1×8 logical array 1 0 0 0 1 1 0 1 fang_check = 1×8 logical array 0 0 0 0 0 0 0 0 temp = '13078260' xy = '16208073' contain_xy = 1×8 logical array 1 1 1 1 1 1 1 1 fang_check = 1×8 logical array 1 1 1 1 1 1 1 1 temp = '13078260' xy = '17557452' contain_xy = 1×8 logical array 1 1 0 0 1 0 0 1 fang_check = 1×8 logical array 0 0 0 0 0 0 1 0 temp = '13078260' xy = '17947290' contain_xy = 1×8 logical array 1 1 0 0 1 1 0 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '18637020' contain_xy = 1×8 logical array 1 1 1 1 1 1 1 1 fang_check = 1×8 logical array 1 1 1 1 1 1 1 1 temp = '13078260' xy = '20706318' contain_xy = 1×8 logical array 1 1 1 1 1 1 1 1 fang_check = 1×8 logical array 1 1 1 1 1 1 1 1 temp = '13078260' xy = '21066210' contain_xy = 1×8 logical array 1 1 1 1 1 1 1 1 fang_check = 1×8 logical array 1 1 1 0 0 0 0 0 temp = '13078260' xy = '21875980' contain_xy = 1×8 logical array 1 1 1 1 0 0 1 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '23405589' contain_xy = 1×8 logical array 1 1 0 1 0 0 1 0 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '24305382' contain_xy = 1×8 logical array 1 0 1 1 0 1 1 1 fang_check = 1×8 logical array 1 0 0 0 1 0 0 1 temp = '13078260' xy = '24845265' contain_xy = 1×8 logical array 1 0 1 0 0 1 1 0 fang_check = 1×8 logical array 0 0 0 0 0 0 0 1 temp = '13078260' xy = '26914860' contain_xy = 1×8 logical array 1 1 0 1 0 1 1 1 fang_check = 1×8 logical array 1 0 0 0 0 1 0 0 temp = '13078260' xy = '29164485' contain_xy = 1×8 logical array 1 0 1 1 0 0 1 0 fang_check = 1×8 logical array 0 0 0 0 0 1 0 0 temp = '13078260' xy = '29904374' contain_xy = 1×8 logical array 1 0 0 1 0 1 1 0 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '31054212' contain_xy = 1×8 logical array 1 1 1 0 0 1 1 1 fang_check = 1×8 logical array 1 0 1 1 0 0 0 0 temp = '13078260' xy = '31594140' contain_xy = 1×8 logical array 1 1 0 0 0 1 0 1 fang_check = 1×8 logical array 1 0 1 0 0 0 0 0 temp = '13078260' xy = '35103726' contain_xy = 1×8 logical array 1 0 1 1 1 1 1 1 fang_check = 1×8 logical array 1 0 0 0 1 0 0 0 temp = '13078260' xy = '35883645' contain_xy = 1×8 logical array 1 0 1 1 1 1 0 0 fang_check = 1×8 logical array 0 0 0 0 0 1 0 1 temp = '13078260' xy = '36453588' contain_xy = 1×8 logical array 1 1 0 0 1 0 1 1 fang_check = 1×8 logical array 0 0 0 0 0 1 0 1 temp = '13078260' xy = '37263510' contain_xy = 1×8 logical array 1 1 1 1 1 0 1 1 fang_check = 1×8 logical array 1 0 0 0 1 0 0 0 temp = '13078260' xy = '41403159' contain_xy = 1×8 logical array 0 1 0 1 1 1 0 0 fang_check = 1×8 logical array 1 0 1 0 0 0 0 0 temp = '13078260' xy = '42123105' contain_xy = 1×8 logical array 0 1 1 1 1 1 1 0 fang_check = 1×8 logical array 1 0 1 1 0 0 0 0 temp = '13078260' xy = '43742990' contain_xy = 1×8 logical array 0 1 1 0 1 0 0 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '44852916' contain_xy = 1×8 logical array 0 0 1 0 1 0 1 1 fang_check = 1×8 logical array 0 0 0 0 0 1 0 0 temp = '13078260' xy = '48602691' contain_xy = 1×8 logical array 0 1 1 1 1 1 0 1 fang_check = 1×8 logical array 1 0 0 0 0 1 0 0 temp = '13078260' xy = '52652484' contain_xy = 1×8 logical array 0 1 1 0 1 0 1 0 fang_check = 1×8 logical array 0 0 0 0 0 0 0 1 temp = '13078260' xy = '53822430' contain_xy = 1×8 logical array 0 1 1 1 1 0 1 1 fang_check = 1×8 logical array 1 0 0 0 1 0 0 1 temp = '13078260' xy = '55892340' contain_xy = 1×8 logical array 0 0 1 0 1 1 0 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '59802187' contain_xy = 1×8 logical array 0 0 1 1 1 1 1 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '62102106' contain_xy = 1×8 logical array 1 1 1 1 1 1 1 1 fang_check = 1×8 logical array 1 1 1 0 0 0 0 0 temp = '13078260' xy = '72901794' contain_xy = 1×8 logical array 1 1 0 1 1 1 0 0 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '74521755' contain_xy = 1×8 logical array 1 0 0 1 1 1 0 0 fang_check = 1×8 logical array 0 0 0 0 0 0 1 0 temp = '13078260' xy = '87481495' contain_xy = 1×8 logical array 1 1 0 1 1 0 0 0 fang_check = 1×8 logical array 0 0 0 0 0 0 0 0 temp = '13078260' xy = '89701458' contain_xy = 1×8 logical array 1 0 1 1 1 0 0 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0 temp = '13078260' xy = '93151404' contain_xy = 1×8 logical array 0 1 1 0 1 0 1 0 fang_check = 1×8 logical array 1 0 1 0 0 0 0 0 temp = '13078260' xy = '94771380' contain_xy = 1×8 logical array 0 0 1 1 1 1 1 1 fang_check = 1×8 logical array 1 0 0 0 0 0 0 0

5   Pass
x = randi([125460 125500],1); factors = vampire_factor(x); correct_factors = []; assert(isequal(factors,correct_factors))