Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 304717

Submitted on 15 Aug 2013 by Mehmet OZC

Correct

110Size
Leading solution size is 42.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

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

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

                    
3
Pass
 
%%
x = 100;
factors = vampire_factor(x);
correct_factors = [];
assert(isequal(factors,correct_factors))
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 7
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
[Warning: Integer operands are required for colon operator when used as index]
[> In vampire_factor at 8
  In verifyCode>evaluateCode at 231
  In verifyCode at 40
  In fevalJSON at 14]
4
Pass
 
%%
x = 13078260;
factors = vampire_factor(x);
correct_factors = [1620 8073; 1863 7020; 2070 6318];
assert(isequal(factors,correct_factors))

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