Cody

# Problem 3001. Sphenic number sequence

Solution 1624378

Submitted on 8 Sep 2018
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 = 1:5; arr_corr = [30, 42, 66, 70, 78]; assert(isequal(sphenic_seq(n),arr_corr))

nlen = 5 funique = 3 fseqlen = 1 funique = 1 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 3 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 4 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 5 arr = 30 42 66 70 78

2   Pass
n = 1:10; arr_corr = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130]; assert(isequal(sphenic_seq(n),arr_corr))

nlen = 10 funique = 3 fseqlen = 1 funique = 1 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 3 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 4 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 5 funique = 1 funique = 2 funique = 1 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 6 funique = 1 funique = 2 funique = 3 fseqlen = 7 funique = 2 funique = 1 funique = 2 funique = 1 funique = 3 fseqlen = 8 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 9 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 1 funique = 2 funique = 3 fseqlen = 10 arr = 30 42 66 70 78 102 105 110 114 130

3   Fail
n = 3:7; arr_corr = [66, 70, 78, 102, 105]; assert(isequal(sphenic_seq(n),arr_corr))

nlen = 5 funique = 3 fseqlen = 1 funique = 1 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 3 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 4 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 5 arr = 30 42 66 70 78

Assertion failed.

4   Fail
n = 20:30; arr_corr = [222 230 231 238 246 255 258 266 273 282 285]; assert(isequal(sphenic_seq(n),arr_corr))

nlen = 11 funique = 3 fseqlen = 1 funique = 1 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 3 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 4 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 5 funique = 1 funique = 2 funique = 1 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 6 funique = 1 funique = 2 funique = 3 fseqlen = 7 funique = 2 funique = 1 funique = 2 funique = 1 funique = 3 fseqlen = 8 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 9 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 1 funique = 2 funique = 3 fseqlen = 10 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 11 arr = 30 42 66 70 78 102 105 110 114 130 138

Assertion failed.

5   Pass
n = 1:53; arr_corr = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310, 318, 322, 345, 354, 357, 366, 370, 374, 385, 399, 402, 406, 410, 418, 426, 429, 430, 434, 435, 438]; assert(isequal(sphenic_seq(n),arr_corr))

nlen = 53 funique = 3 fseqlen = 1 funique = 1 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 3 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 4 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 5 funique = 1 funique = 2 funique = 1 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 6 funique = 1 funique = 2 funique = 3 fseqlen = 7 funique = 2 funique = 1 funique = 2 funique = 1 funique = 3 fseqlen = 8 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 9 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 1 funique = 2 funique = 3 fseqlen = 10 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 11 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 12 funique = 2 funique = 3 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 13 funique = 2 funique = 1 funique = 3 funique = 1 funique = 3 fseqlen = 14 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 15 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 3 fseqlen = 16 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 17 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 18 funique = 1 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 19 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 4 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 2 funique = 3 fseqlen = 20 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 3 fseqlen = 21 funique = 3 fseqlen = 22 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 23 funique = 1 funique = 3 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 24 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 3 fseqlen = 25 funique = 1 funique = 1 funique = 3 fseqlen = 26 funique = 2 funique = 3 funique = 2 funique = 2 funique = 1 funique = 3 funique = 2 funique = 3 fseqlen = 27 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 3 fseqlen = 28 funique = 2 funique = 2 funique = 3 funique = 1 funique = 2 funique = 2 funique = 3 funique = 1 funique = 3 fseqlen = 29 funique = 1 funique = 2 funique = 3 fseqlen = 30 funique = 3 fseqlen = 31 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 32 funique = 2 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 1 funique = 3 funique = 2 funique = 3 fseqlen = 33 funique = 1 funique = 3 funique = 1 funique = 2 funique = 3 funique = 2 funique = 1 funique = 3 fseqlen = 34 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 35 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 4 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 1 funique = 2 funique = 2 funique = 3 funique = 2 funique = 3 funique = 1 funique = 2 funique = 3 fseqlen = 36 funique = 2 funique = 1 funique = 3 funique = 1 funique = 3 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 37 funique = 2 funique = 2 funique = 3 fseqlen = 38 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 3 funique = 2 funique = 3 fseqlen = 39 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 40 funique = 2 funique = 3 funique = 1 funique = 3 fseqlen = 41 funique = 2 funique = 2 funique = 2 funique = 3 funique = 1 funique = 3 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 42 funique = 2 funique = 2 funique = 2 funique = 1 funique = 4 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 1 funique = 2 funique = 3 fseqlen = 43 funique = 2 funique = 1 funique = 3 fseqlen = 44 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 45 funique = 2 funique = 3 funique = 1 funique = 3 fseqlen = 46 funique = 2 funique = 2 funique = 2 funique = 3 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 47 funique = 1 funique = 4 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 48 funique = 2 funique = 2 funique = 3 fseqlen = 49 funique = 3 fseqlen = 50 funique = 1 funique = 2 funique = 1 funique = 3 fseqlen = 51 funique = 3 fseqlen = 52 funique = 2 funique = 2 funique = 3 fseqlen = 53 arr = Columns 1 through 29 30 42 66 70 78 102 105 110 114 130 138 154 165 170 174 182 186 190 195 222 230 231 238 246 255 258 266 273 282 Columns 30 through 53 285 286 290 310 318 322 345 354 357 366 370 374 385 399 402 406 410 418 426 429 430 434 435 438

6   Fail
i1 = randi(20,1); n = i1:(i1+randi(25,1)); arr_tot = [30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, 170, 174, 182, 186, 190, 195, 222, 230, 231, 238, 246, 255, 258, 266, 273, 282, 285, 286, 290, 310, 318, 322, 345, 354, 357, 366, 370, 374, 385, 399, 402, 406, 410, 418, 426, 429, 430, 434, 435, 438]; arr_corr = arr_tot(n); assert(isequal(sphenic_seq(n),arr_corr))

nlen = 20 funique = 3 fseqlen = 1 funique = 1 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 3 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 4 funique = 1 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 5 funique = 1 funique = 2 funique = 1 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 6 funique = 1 funique = 2 funique = 3 fseqlen = 7 funique = 2 funique = 1 funique = 2 funique = 1 funique = 3 fseqlen = 8 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 9 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 1 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 1 funique = 2 funique = 3 fseqlen = 10 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 11 funique = 1 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 3 fseqlen = 12 funique = 2 funique = 3 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 13 funique = 2 funique = 1 funique = 3 funique = 1 funique = 3 fseqlen = 14 funique = 2 funique = 2 funique = 1 funique = 3 fseqlen = 15 funique = 2 funique = 2 funique = 2 funique = 2 funique = 1 funique = 3 funique = 1 funique = 3 fseqlen = 16 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 17 funique = 2 funique = 2 funique = 2 funique = 3 fseqlen = 18 funique = 1 funique = 2 funique = 1 funique = 2 funique = 3 fseqlen = 19 funique = 2 funique = 1 funique = 3 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 4 funique = 1 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 2 funique = 3 funique = 2 funique = 3 fseqlen = 20 arr = 30 42 66 70 78 102 105 110 114 130 138 154 165 170 174 182 186 190 195 222

Assertion failed.