Cody

Problem 1825. Find all vampire fangs

Solution 2786017

Submitted on 5 Aug 2020 by Nadee Seneviratne
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))

012358 012456 145667 012456 013778 012456 016789 012456 012456 012456 y = 204 615 012256 012456 012456 012456 y = 204 615 246 510 224559 012456 001346 012456 033469 012456

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

1278 1278 y = 21 87 2369 1278

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))

01347789 00123678 01134459 00123678 01457889 00123678 14457889 00123678 00123678 00123678 y = 1620 8073 12455577 00123678 01247799 00123678 00123678 00123678 y = 1620 8073 1863 7020 00123678 00123678 y = 1620 8073 1863 7020 2070 6318 00112266 00123678 01257889 00123678 02345589 00123678 02233458 00123678 22445568 00123678 01246689 00123678 12445689 00123678 02344799 00123678 01122345 00123678 01134459 00123678 01233567 00123678 33455688 00123678

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

Suggested Problems

More from this Author9

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!