Cody

Solution 882199

Submitted on 26 Apr 2016 by James
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
n = 6; [a b c d] = numcons(n); assert(all([a b c d]==0))

maxaval = 2

2   Pass
n = 11; [a b c d] = numcons(n); assert(all([a b c d]==0))

maxaval = 2

3   Pass
n = 8; [a b c d] = numcons(n); assert(all(mod([a b c d],1)==0)) assert(all([a b c d]>1)) assert(a*sqrt(b)+c*sqrt(d)==n)

maxaval = 2

4   Pass
n = 41; [a b c d] = numcons(n); assert(all(mod([a b c d],1)==0)) assert(all([a b c d]>1)) assert(a*sqrt(b)+c*sqrt(d)==n)

maxaval = 17

5   Pass
n = 841; [a b c d] = numcons(n); assert(all(mod([a b c d],1)==0)) assert(all([a b c d]>1)) assert(a*sqrt(b)+c*sqrt(d)==n)

maxaval = 417