Cody

Problem 44289. Find two triangular numbers whose sum is input.

Solution 2705961

Submitted on 17 Jul 2020 by Ramesh Kumar V
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 = 400; y_correct = [190 210]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0 flag = 1 z = 190 210 z = 190 210

2   Pass
x = 196; y_correct = [91 105]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0 flag = 1 z = 91 105 z = 91 105

3   Pass
x = 676; y_correct = [325 351]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0 flag = 1 z = 325 351 z = 325 351

4   Pass
x = 1225; y_correct = [595 630]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0 flag = 1 z = 595 630 z = 595 630

5   Pass
x = 1849; y_correct = [903 946]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0 flag = 1 z = 903 946 z = 903 946

6   Pass
x = 10000; y_correct = [4950 5050]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0 flag = 1 z = 5050 4950 z = 4950 5050

7   Pass
x = 11025; y_correct = [5460 5565]; assert(isequal(twoTriangular(x),y_correct))

s = [] flag = 0 flag = 1 z = 5565 5460 z = 5460 5565