Cody

Problem 46615. Find terms in the Connell sequence

Solution 3757248

Submitted on 21 Nov 2020 by David Hill
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
filetext = fileread('Connell.m'); noloops = isempty(strfind(filetext, 'for')) && isempty(strfind(filetext, 'while')); assert(noloops, 'No loops allowed')

2   Pass
n = 1:10; y_correct = [1 2 4 5 7 9 10 12 14 16]; assert(isequal(Connell(n),y_correct))

3   Pass
n = 35:40; y_correct = [62 64 65 67 69 71]; assert(isequal(Connell(n),y_correct))

4   Pass
n = 628:633; y_correct = [1221 1223 1225 1226 1228 1230]; assert(isequal(Connell(n),y_correct))

5   Pass
n = 1620:1625; y_correct = 3183:2:3193; assert(isequal(Connell(n),y_correct))

6   Pass
n = 11111:11111:66666; y_correct = [22073 44233 66408 88590 110777 132967]; assert(isequal(Connell(n),y_correct))

7   Pass
n = 12457910; y_correct = 24910828; assert(isequal(Connell(n),y_correct))

8   Pass
n = 12457910121416; y_correct = 24915815251257; assert(isequal(Connell(n),y_correct))