Cody

# Problem 44360. Pentagonal Numbers

Solution 1295512

Submitted on 18 Oct 2017 by Sunke
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
x1 = 1; x2 = 25; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1,5,12,22])) assert(isequal(d,[0,1,0,0]))

istep = 1 p = 1 d = 0 istep = 2 istep = 3 istep = 4 istep = 5 p = 1 5 d = 0 1 istep = 6 istep = 7 istep = 8 istep = 9 istep = 10 istep = 11 istep = 12 p = 1 5 12 d = 0 1 0 istep = 13 istep = 14 istep = 15 istep = 16 istep = 17 istep = 18 istep = 19 istep = 20 istep = 21 istep = 22 p = 1 5 12 22 d = 0 1 0 0 istep = 23 istep = 24 istep = 25 p = 1 5 12 22 d = 0 1 0 0

2   Pass
x1 = 1; x2 = 4; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,1)) assert(isequal(d,0))

istep = 1 p = 1 d = 0 istep = 2 istep = 3 istep = 4 p = 1 d = 0

3   Pass
x1 = 10; x2 = 40; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[12,22,35])) assert(isequal(d,[0,0,1]))

istep = 10 istep = 11 istep = 12 p = 12 d = 0 istep = 13 istep = 14 istep = 15 istep = 16 istep = 17 istep = 18 istep = 19 istep = 20 istep = 21 istep = 22 p = 12 22 d = 0 0 istep = 23 istep = 24 istep = 25 istep = 26 istep = 27 istep = 28 istep = 29 istep = 30 istep = 31 istep = 32 istep = 33 istep = 34 istep = 35 p = 12 22 35 d = 0 0 1 istep = 36 istep = 37 istep = 38 istep = 39 istep = 40 p = 12 22 35 d = 0 0 1

4   Pass
x1 = 10; x2 = 99; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[12,22,35,51,70,92])) assert(isequal(d,[0,0,1,0,1,0]))

istep = 10 istep = 11 istep = 12 p = 12 d = 0 istep = 13 istep = 14 istep = 15 istep = 16 istep = 17 istep = 18 istep = 19 istep = 20 istep = 21 istep = 22 p = 12 22 d = 0 0 istep = 23 istep = 24 istep = 25 istep = 26 istep = 27 istep = 28 istep = 29 istep = 30 istep = 31 istep = 32 istep = 33 istep = 34 istep = 35 p = 12 22 35 d = 0 0 1 istep = 36 istep = 37 istep = 38 istep = 39 istep = 40 istep = 41 istep = 42 istep = 43 istep = 44 istep = 45 istep = 46 istep = 47 istep = 48 istep = 49 istep = 50 istep = 51 p = 12 22 35 51 d = 0 0 1 0 istep = 52 istep = 53 istep = 54 istep = 55 istep = 56 istep = 57 istep = 58 istep = 59 istep = 60 istep = 61 istep = 62 istep = 63 istep = 64 istep = 65 istep = 66 istep = 67 istep = 68 istep = 69 istep = 70 p = 12 22 35 51 70 d = 0 0 1 0 1 istep = 71 istep = 72 istep = 73 istep = 74 istep = 75 istep = 76 istep = 77 istep = 78 istep = 79 istep = 80 istep = 81 istep = 82 istep = 83 istep = 84 istep = 85 istep = 86 istep = 87 istep = 88 istep = 89 istep = 90 istep = 91 istep = 92 p = 12 22 35 51 70 92 d = 0 0 1 0 1 0 istep = 93 istep = 94 istep = 95 istep = 96 istep = 97 istep = 98 istep = 99 p = 12 22 35 51 70 92 d = 0 0 1 0 1 0

5   Pass
x1 = 100; x2 = 999; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925])) assert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1]))

istep = 100 istep = 101 istep = 102 istep = 103 istep = 104 istep = 105 istep = 106 istep = 107 istep = 108 istep = 109 istep = 110 istep = 111 istep = 112 istep = 113 istep = 114 istep = 115 istep = 116 istep = 117 p = 117 d = 0 istep = 118 istep = 119 istep = 120 istep = 121 istep = 122 istep = 123 istep = 124 istep = 125 istep = 126 istep = 127 istep = 128 istep = 129 istep = 130 istep = 131 istep = 132 istep = 133 istep = 134 istep = 135 istep = 136 istep = 137 istep = 138 istep = 139 istep = 140 istep = 141 istep = 142 istep = 143 istep = 144 istep = 145 p = 117 145 d = 0 1 istep = 146 istep = 147 istep = 148 istep = 149 istep = 150 istep = 151 istep = 152 istep = 153 istep = 154 istep = 155 istep = 156 istep = 157 istep = 158 istep = 159 istep = 160 istep = 161 istep = 162 istep = 163 istep = 164 istep = 165 istep = 166 istep = 167 istep = 168 istep = 169 istep = 170 istep = 171 istep = 172 istep = 173 istep = 174 istep = 175 istep = 176 p = 117 145 176 d = 0 1 0 istep = 177 istep = 178 istep = 179 istep = 180 istep = 181 istep = 182 istep = 183 istep = 184 istep = 185 istep = 186 istep = 187 istep = 188 istep = 189 istep = 190 istep = 191 istep = 192 istep = 193 istep = 194 istep = 195 istep = 196 istep = 197 istep = 198 istep = 199 istep = 200 istep = 201 istep = 202 istep = 203 istep = 204 istep = 205 istep = 206 istep = 207 istep = 208 istep = 209 istep = 210 p = 117 145 176 210 d = 0 1 0 1 istep = 211 istep = 212 istep = 213 istep = 214 istep = 215 istep = 216 istep = 217 istep = 218 istep = 219 istep = 220 istep = 221 istep = 222 istep = 223 istep = 224 istep = 225 istep = 226 istep = 227 istep = 228 istep = 229 istep = 230 istep = 231 istep = 232 istep = 233 istep = 234 istep = 235 istep = 236 istep = 237 istep = 238 istep = 239 istep = 240 istep = 241 istep = 242 istep = 243 istep = 244 istep = 245 istep = 246 istep = 247 p = 117 145 176 210 247 d = 0 1 0 1 0 istep = 248 istep = 249 istep = 250 istep = 251 istep = 252 istep = 253 istep = 254 istep = 255 istep = 256 istep = 257 istep = 258 istep = 259 istep = 260 istep = 261 istep = 262 istep = 263 istep = 264 istep = 265 istep = 266 istep = 267 istep = 268 istep = 269 istep = 270 istep = 271 istep = 272 istep = 273 istep = 274 istep = 275 istep = 276 istep = 277 istep = 278 istep = 279 istep = 280 istep = 281 istep = 282 istep = 283 istep = 284 istep = 285 istep = 286 istep = 287 p = 117 145 176 210 247 287 d = 0 1 0 1 0 0 istep = 288 istep = 289 istep = 290 istep = 291 istep = 292 istep = 293 istep = 294 istep = 295 istep = 296 istep = 297 istep = 298 istep = 299 istep = 300 istep = 301 istep = 302 istep = 303 istep = 304 istep = 305 istep = 306 istep = 307 istep = 308 istep = 309 istep = 310 istep = 311 istep = 312 istep = 313 istep = 314 istep = 315 istep = 316 istep = 317 istep = 318 istep = 319 istep = 320 istep = 321 istep = 322 istep = 323 istep = 324 istep = 325 istep = 326 istep = 327 istep = 328 istep = 329 istep = 330 p = 117 145 176 210 247 287 330 d = 0 1 0 1 0 0 1 istep = 331 istep = 332 istep = 333 istep = 334 istep = 335 istep = 336 istep = 337 istep = 338 istep = 339 istep = 340 istep = 341 istep = 342 istep = 343 istep = 344 istep = 345 istep = 346 istep = 347 istep = 348 istep = 349 istep = 350 istep = 351 istep = 352 istep = 353 istep = 354 istep = 355 istep = 356 istep = 357 istep = 358 istep = 359 istep = 360 istep = 361 istep = 362 istep = 363 istep = 364 istep = 365 istep = 366 istep = 367 istep = 368 istep = 369 istep = 370 istep = 371 istep = 372 istep = 373 istep = 374 istep = 375 istep = 376 p = 117 145 176 210 247 287 330 376 d = 0 1 0 1 0 0 1 0 istep = 377 istep = 378 istep = 379 istep = 380 istep = 381 istep = 382 istep = 383 istep = 384 istep = 385 istep = 386 istep = 387 istep = 388 istep = 389 istep = 390 istep = 391 istep = 392 istep = 393 istep = 394 istep = 395 istep = 396 istep = 397 istep = 398 istep = 399 istep = 400 istep = 401 istep = 402 istep = 403 istep = 404 istep = 405 istep = 406 istep = 407 istep = 408 istep = 409 istep = 410 istep = 411 istep = 412 istep = 413 istep = 414 istep = 415 istep = 416 istep = 417 istep = 418 istep = 419 istep = 420 istep = 421 istep = 422 istep = 423 istep = 424 istep = 425 p = 117 145 176 210 247 287 330 376 425 d = 0 1 0 1 0 0 1 0 1 istep = 426 istep = 427 istep = 428 istep = 429 istep = 430 istep = 431 istep = 432 istep = 433 istep = 434 istep = 435 istep = 436 istep = 437 istep = 438 istep = 439 istep = 440 istep = 441 istep = 442 istep = 443 istep = 444 istep = 445 istep = 446 istep = 447 istep = 448 istep = 449 istep = 450 istep = 451 istep = 452 istep = 453 istep = 454 istep = 455 istep = 456 istep = 457 istep = 458 istep = 459 istep = 460 istep = 461 istep = 462 istep = 463 istep = 464 istep = 465 istep = 466 istep = 467 istep = 468 istep = 469 istep = 470 istep = 471 istep = 472 istep = 473 istep = 474 istep = 475 istep = 476 istep = 477 p = 117 145 176 210 247 287 330 376 425 477 d = 0 1 0 1 0 0 1 0 1 0 istep = 478 istep = 479 istep = 480 istep = 481 istep = 482 istep = 483 istep = 484 istep = 485 istep = 486 istep = 487 istep = 488 istep = 489 istep = 490 istep = 491 istep = 492 istep = 493 istep = 494 istep = 495 istep = 496 istep = 497 istep = 498 istep = 499 istep = 500 istep = 501 istep = 502 istep = 503 istep = 504 istep = 505 istep = 506 istep = 507 istep = 508 istep = 509 istep = 510 istep = 511 istep = 512 istep = 513 istep = 514 istep = 515 istep = 516 istep = 517 istep = 518 istep = 519 istep = 520 istep = 521 istep = 522 istep = 523 istep = 524 istep = 525 istep = 526 istep = 527 istep = 528 istep = 529 istep = 530 istep = 531 istep = 532 p = 117 145 176 210 247 287 330 376 425 477 532 d = 0 1 0 1 0 0 1 0 1 0 0 istep = 533 istep = 534 istep = 535 istep = 536 istep = 537 istep = 538 istep = 539 istep = 540 istep = 541 istep = 542 istep = 543 istep = 544 istep = 545 istep = 546 istep = 547 istep = 548 istep = 549 istep = 550 istep = 551 istep = 552 istep = 553 istep = 554 istep = 555 istep = 556 istep = 557 istep = 558 istep = 559 istep = 560 istep = 561 istep = 562 istep = 563 istep = 564 istep = 565 istep = 566 istep = 567 istep = 568 istep = 569 istep = 570 istep = 571 istep = 572 istep = 573 istep = 574 istep = 575 istep = 576 istep = 577 istep = 578 istep = 579 istep = 580 istep = 581 istep = 582 istep = 583 istep = 584 istep = 585 istep = 586 istep = 587 istep = 588 istep = 589 istep = 590 p = 117 145 176 210 247 287 330 376 425 477 532 590 d = 0 1 0 1 0 0 1 0 1 0 0 1 istep = 591 istep = 592 ...

6   Pass
x1 = 40; x2 = 50; [p,d] = pentagonal_numbers(x1,x2) assert(isempty(p)) assert(isempty(d))

istep = 40 istep = 41 istep = 42 istep = 43 istep = 44 istep = 45 istep = 46 istep = 47 istep = 48 istep = 49 istep = 50 p = [] d = []

7   Pass
x1 = 1000; x2 = 1500; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1001,1080,1162,1247,1335,1426])) assert(isequal(d,[0,1,0,0,1,0]))

istep = 1000 istep = 1001 p = 1001 d = 0 istep = 1002 istep = 1003 istep = 1004 istep = 1005 istep = 1006 istep = 1007 istep = 1008 istep = 1009 istep = 1010 istep = 1011 istep = 1012 istep = 1013 istep = 1014 istep = 1015 istep = 1016 istep = 1017 istep = 1018 istep = 1019 istep = 1020 istep = 1021 istep = 1022 istep = 1023 istep = 1024 istep = 1025 istep = 1026 istep = 1027 istep = 1028 istep = 1029 istep = 1030 istep = 1031 istep = 1032 istep = 1033 istep = 1034 istep = 1035 istep = 1036 istep = 1037 istep = 1038 istep = 1039 istep = 1040 istep = 1041 istep = 1042 istep = 1043 istep = 1044 istep = 1045 istep = 1046 istep = 1047 istep = 1048 istep = 1049 istep = 1050 istep = 1051 istep = 1052 istep = 1053 istep = 1054 istep = 1055 istep = 1056 istep = 1057 istep = 1058 istep = 1059 istep = 1060 istep = 1061 istep = 1062 istep = 1063 istep = 1064 istep = 1065 istep = 1066 istep = 1067 istep = 1068 istep = 1069 istep = 1070 istep = 1071 istep = 1072 istep = 1073 istep = 1074 istep = 1075 istep = 1076 istep = 1077 istep = 1078 istep = 1079 istep = 1080 p = 1001 1080 d = 0 1 istep = 1081 istep = 1082 istep = 1083 istep = 1084 istep = 1085 istep = 1086 istep = 1087 istep = 1088 istep = 1089 istep = 1090 istep = 1091 istep = 1092 istep = 1093 istep = 1094 istep = 1095 istep = 1096 istep = 1097 istep = 1098 istep = 1099 istep = 1100 istep = 1101 istep = 1102 istep = 1103 istep = 1104 istep = 1105 istep = 1106 istep = 1107 istep = 1108 istep = 1109 istep = 1110 istep = 1111 istep = 1112 istep = 1113 istep = 1114 istep = 1115 istep = 1116 istep = 1117 istep = 1118 istep = 1119 istep = 1120 istep = 1121 istep = 1122 istep = 1123 istep = 1124 istep = 1125 istep = 1126 istep = 1127 istep = 1128 istep = 1129 istep = 1130 istep = 1131 istep = 1132 istep = 1133 istep = 1134 istep = 1135 istep = 1136 istep = 1137 istep = 1138 istep = 1139 istep = 1140 istep = 1141 istep = 1142 istep = 1143 istep = 1144 istep = 1145 istep = 1146 istep = 1147 istep = 1148 istep = 1149 istep = 1150 istep = 1151 istep = 1152 istep = 1153 istep = 1154 istep = 1155 istep = 1156 istep = 1157 istep = 1158 istep = 1159 istep = 1160 istep = 1161 istep = 1162 p = 1001 1080 1162 d = 0 1 0 istep = 1163 istep = 1164 istep = 1165 istep = 1166 istep = 1167 istep = 1168 istep = 1169 istep = 1170 istep = 1171 istep = 1172 istep = 1173 istep = 1174 istep = 1175 istep = 1176 istep = 1177 istep = 1178 istep = 1179 istep = 1180 istep = 1181 istep = 1182 istep = 1183 istep = 1184 istep = 1185 istep = 1186 istep = 1187 istep = 1188 istep = 1189 istep = 1190 istep = 1191 istep = 1192 istep = 1193 istep = 1194 istep = 1195 istep = 1196 istep = 1197 istep = 1198 istep = 1199 istep = 1200 istep = 1201 istep = 1202 istep = 1203 istep = 1204 istep = 1205 istep = 1206 istep = 1207 istep = 1208 istep = 1209 istep = 1210 istep = 1211 istep = 1212 istep = 1213 istep = 1214 istep = 1215 istep = 1216 istep = 1217 istep = 1218 istep = 1219 istep = 1220 istep = 1221 istep = 1222 istep = 1223 istep = 1224 istep = 1225 istep = 1226 istep = 1227 istep = 1228 istep = 1229 istep = 1230 istep = 1231 istep = 1232 istep = 1233 istep = 1234 istep = 1235 istep = 1236 istep = 1237 istep = 1238 istep = 1239 istep = 1240 istep = 1241 istep = 1242 istep = 1243 istep = 1244 istep = 1245 istep = 1246 istep = 1247 p = 1001 1080 1162 1247 d = 0 1 0 0 istep = 1248 istep = 1249 istep = 1250 istep = 1251 istep = 1252 istep = 1253 istep = 1254 istep = 1255 istep = 1256 istep = 1257 istep = 1258 istep = 1259 istep = 1260 istep = 1261 istep = 1262 istep = 1263 istep = 1264 istep = 1265 istep = 1266 istep = 1267 istep = 1268 istep = 1269 istep = 1270 istep = 1271 istep = 1272 istep = 1273 istep = 1274 istep = 1275 istep = 1276 istep = 1277 istep = 1278 istep = 1279 istep = 1280 istep = 1281 istep = 1282 istep = 1283 istep = 1284 istep = 1285 istep = 1286 istep = 1287 istep = 1288 istep = 1289 istep = 1290 istep = 1291 istep = 1292 istep = 1293 istep = 1294 istep = 1295 istep = 1296 istep = 1297 istep = 1298 istep = 1299 istep = 1300 istep = 1301 istep = 1302 istep = 1303 istep = 1304 istep = 1305 istep = 1306 istep = 1307 istep = 1308 istep = 1309 istep = 1310 istep = 1311 istep = 1312 istep = 1313 istep = 1314 istep = 1315 istep = 1316 istep = 1317 istep = 1318 istep = 1319 istep = 1320 istep = 1321 istep = 1322 istep = 1323 istep = 1324 istep = 1325 istep = 1326 istep = 1327 istep = 1328 istep = 1329 istep = 1330 istep = 1331 istep = 1332 istep = 1333 istep = 1334 istep = 1335 p = 1001 1080 1162 1247 1335 d = 0 1 0 0 1 istep = 1336 istep = 1337 istep = 1338 istep = 1339 istep = 1340 istep = 1341 istep = 1342 istep = 1343 istep = 1344 istep = 1345 istep = 1346 istep = 1347 istep = 1348 istep = 1349 istep = 1350 istep = 1351 istep = 1352 istep = 1353 istep = 1354 istep = 1355 istep = 1356 istep = 1357 istep = 1358 istep = 1359 istep = 1360 istep = 1361 istep = 1362 istep = 1363 istep = 1364 istep = 1365 istep = 1366 istep = 1367 istep = 1368 istep = 1369 istep = 1370 istep = 1371 istep = 1372 istep = 1373 istep = 1374 istep = 1375 istep = 1376 istep = 1377 istep = 1378 istep = 1379 istep = 1380 istep = 1381 istep = 1382 istep = 1383 istep = 1384 istep = 1385 istep = 1386 istep = 1387 istep = 1388 istep = 1389 istep = 1390 istep = 1391 istep = 1392 istep = 1393 istep = 1394 istep = 1395 istep = 1396 istep = 1397 istep = 1398 istep = 1399 istep = 1400 istep = 1401 is...

8   Pass
x1 = 1500; x2 = 3000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882])) assert(isequal(d,[1,0,0,1,0,1,0,0,1,0,1,0,0]))

istep = 1500 istep = 1501 istep = 1502 istep = 1503 istep = 1504 istep = 1505 istep = 1506 istep = 1507 istep = 1508 istep = 1509 istep = 1510 istep = 1511 istep = 1512 istep = 1513 istep = 1514 istep = 1515 istep = 1516 istep = 1517 istep = 1518 istep = 1519 istep = 1520 p = 1520 d = 1 istep = 1521 istep = 1522 istep = 1523 istep = 1524 istep = 1525 istep = 1526 istep = 1527 istep = 1528 istep = 1529 istep = 1530 istep = 1531 istep = 1532 istep = 1533 istep = 1534 istep = 1535 istep = 1536 istep = 1537 istep = 1538 istep = 1539 istep = 1540 istep = 1541 istep = 1542 istep = 1543 istep = 1544 istep = 1545 istep = 1546 istep = 1547 istep = 1548 istep = 1549 istep = 1550 istep = 1551 istep = 1552 istep = 1553 istep = 1554 istep = 1555 istep = 1556 istep = 1557 istep = 1558 istep = 1559 istep = 1560 istep = 1561 istep = 1562 istep = 1563 istep = 1564 istep = 1565 istep = 1566 istep = 1567 istep = 1568 istep = 1569 istep = 1570 istep = 1571 istep = 1572 istep = 1573 istep = 1574 istep = 1575 istep = 1576 istep = 1577 istep = 1578 istep = 1579 istep = 1580 istep = 1581 istep = 1582 istep = 1583 istep = 1584 istep = 1585 istep = 1586 istep = 1587 istep = 1588 istep = 1589 istep = 1590 istep = 1591 istep = 1592 istep = 1593 istep = 1594 istep = 1595 istep = 1596 istep = 1597 istep = 1598 istep = 1599 istep = 1600 istep = 1601 istep = 1602 istep = 1603 istep = 1604 istep = 1605 istep = 1606 istep = 1607 istep = 1608 istep = 1609 istep = 1610 istep = 1611 istep = 1612 istep = 1613 istep = 1614 istep = 1615 istep = 1616 istep = 1617 p = 1520 1617 d = 1 0 istep = 1618 istep = 1619 istep = 1620 istep = 1621 istep = 1622 istep = 1623 istep = 1624 istep = 1625 istep = 1626 istep = 1627 istep = 1628 istep = 1629 istep = 1630 istep = 1631 istep = 1632 istep = 1633 istep = 1634 istep = 1635 istep = 1636 istep = 1637 istep = 1638 istep = 1639 istep = 1640 istep = 1641 istep = 1642 istep = 1643 istep = 1644 istep = 1645 istep = 1646 istep = 1647 istep = 1648 istep = 1649 istep = 1650 istep = 1651 istep = 1652 istep = 1653 istep = 1654 istep = 1655 istep = 1656 istep = 1657 istep = 1658 istep = 1659 istep = 1660 istep = 1661 istep = 1662 istep = 1663 istep = 1664 istep = 1665 istep = 1666 istep = 1667 istep = 1668 istep = 1669 istep = 1670 istep = 1671 istep = 1672 istep = 1673 istep = 1674 istep = 1675 istep = 1676 istep = 1677 istep = 1678 istep = 1679 istep = 1680 istep = 1681 istep = 1682 istep = 1683 istep = 1684 istep = 1685 istep = 1686 istep = 1687 istep = 1688 istep = 1689 istep = 1690 istep = 1691 istep = 1692 istep = 1693 istep = 1694 istep = 1695 istep = 1696 istep = 1697 istep = 1698 istep = 1699 istep = 1700 istep = 1701 istep = 1702 istep = 1703 istep = 1704 istep = 1705 istep = 1706 istep = 1707 istep = 1708 istep = 1709 istep = 1710 istep = 1711 istep = 1712 istep = 1713 istep = 1714 istep = 1715 istep = 1716 istep = 1717 p = 1520 1617 1717 d = 1 0 0 istep = 1718 istep = 1719 istep = 1720 istep = 1721 istep = 1722 istep = 1723 istep = 1724 istep = 1725 istep = 1726 istep = 1727 istep = 1728 istep = 1729 istep = 1730 istep = 1731 istep = 1732 istep = 1733 istep = 1734 istep = 1735 istep = 1736 istep = 1737 istep = 1738 istep = 1739 istep = 1740 istep = 1741 istep = 1742 istep = 1743 istep = 1744 istep = 1745 istep = 1746 istep = 1747 istep = 1748 istep = 1749 istep = 1750 istep = 1751 istep = 1752 istep = 1753 istep = 1754 istep = 1755 istep = 1756 istep = 1757 istep = 1758 istep = 1759 istep = 1760 istep = 1761 istep = 1762 istep = 1763 istep = 1764 istep = 1765 istep = 1766 istep = 1767 istep = 1768 istep = 1769 istep = 1770 istep = 1771 istep = 1772 istep = 1773 istep = 1774 istep = 1775 istep = 1776 istep = 1777 istep = 1778 istep = 1779 istep = 1780 istep = 1781 istep = 1782 istep = 1783 istep = 1784 istep = 1785 istep = 1786 istep = 1787 istep = 1788 istep = 1789 istep = 1790 istep = 1791 istep = 1792 istep = 1793 istep = 1794 istep = 1795 istep = 1796 istep = 1797 istep = 1798 istep = 1799 istep = 1800 istep = 1801 istep = 1802 istep = 1803 istep = 1804 istep = 1805 istep = 1806 istep = 1807 istep = 1808 istep = 1809 istep = 1810 istep = 1811 istep = 1812 istep = 1813 istep = 1814 istep = 1815 istep = 1816 istep = 1817 istep = 1818 istep = 1819 istep = 1820 p = 1520 1617 1717 1820 d = 1 0 0 1 istep = 1821 istep = 1822 istep = 1823 istep = 1824 istep = 1825 istep = 1826 istep = 1827 istep = 1828 istep = 1829 istep = 1830 istep = 1831 istep = 1832 istep = 1833 istep = 1834 istep = 1835 istep = 1836 istep = 1837 istep = 1838 istep = 1839 istep = 1840 istep = 1841 istep = 1842 istep = 1843 istep = 1844 istep = 1845 istep = 1846 istep = 1847 istep = 1848 istep = 1849 istep = 1850 istep = 1851 istep = 1852 istep = 1853 istep = 1854 istep = 1855 istep = 1856 istep = 1857 istep = 1858 istep = 1859 istep = 1860 istep = 1861 istep = 1862 istep = 1863 istep = 1864 istep = 1865 istep = 1866 istep = 1867 istep = 1868 istep = 1869 istep = 1870 istep = 1871 istep = 1872 istep = 1873 istep = 1874 istep = 1875 istep = 1876 istep = 1877 istep = 1878 istep = 1879 istep = 1880 istep = 1881 istep = 1882 istep = 1883 istep = 1884 istep = 1885 istep = 1886 istep = 1887 istep = 1888 istep = 1889 istep = 1890 istep = 1891 istep = 1892 istep = 1893 istep = 1894 istep = 1895 istep = 1896 istep = 1897 istep = 1898 istep = 1899 istep = 1900 istep = 1901 istep = 1902 istep = 1903 istep = 1904 istep = 1905 istep = ...

9   Pass
x1 = 1; x2 = 3000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1,5,12,22,35,51,70,92,117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925,1001,1080,1162,1247,1335,1426,1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882])) assert(isequal(d,[0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0]))

istep = 1 p = 1 d = 0 istep = 2 istep = 3 istep = 4 istep = 5 p = 1 5 d = 0 1 istep = 6 istep = 7 istep = 8 istep = 9 istep = 10 istep = 11 istep = 12 p = 1 5 12 d = 0 1 0 istep = 13 istep = 14 istep = 15 istep = 16 istep = 17 istep = 18 istep = 19 istep = 20 istep = 21 istep = 22 p = 1 5 12 22 d = 0 1 0 0 istep = 23 istep = 24 istep = 25 istep = 26 istep = 27 istep = 28 istep = 29 istep = 30 istep = 31 istep = 32 istep = 33 istep = 34 istep = 35 p = 1 5 12 22 35 d = 0 1 0 0 1 istep = 36 istep = 37 istep = 38 istep = 39 istep = 40 istep = 41 istep = 42 istep = 43 istep = 44 istep = 45 istep = 46 istep = 47 istep = 48 istep = 49 istep = 50 istep = 51 p = 1 5 12 22 35 51 d = 0 1 0 0 1 0 istep = 52 istep = 53 istep = 54 istep = 55 istep = 56 istep = 57 istep = 58 istep = 59 istep = 60 istep = 61 istep = 62 istep = 63 istep = 64 istep = 65 istep = 66 istep = 67 istep = 68 istep = 69 istep = 70 p = 1 5 12 22 35 51 70 d = 0 1 0 0 1 0 1 istep = 71 istep = 72 istep = 73 istep = 74 istep = 75 istep = 76 istep = 77 istep = 78 istep = 79 istep = 80 istep = 81 istep = 82 istep = 83 istep = 84 istep = 85 istep = 86 istep = 87 istep = 88 istep = 89 istep = 90 istep = 91 istep = 92 p = 1 5 12 22 35 51 70 92 d = 0 1 0 0 1 0 1 0 istep = 93 istep = 94 istep = 95 istep = 96 istep = 97 istep = 98 istep = 99 istep = 100 istep = 101 istep = 102 istep = 103 istep = 104 istep = 105 istep = 106 istep = 107 istep = 108 istep = 109 istep = 110 istep = 111 istep = 112 istep = 113 istep = 114 istep = 115 istep = 116 istep = 117 p = 1 5 12 22 35 51 70 92 117 d = 0 1 0 0 1 0 1 0 0 istep = 118 istep = 119 istep = 120 istep = 121 istep = 122 istep = 123 istep = 124 istep = 125 istep = 126 istep = 127 istep = 128 istep = 129 istep = 130 istep = 131 istep = 132 istep = 133 istep = 134 istep = 135 istep = 136 istep = 137 istep = 138 istep = 139 istep = 140 istep = 141 istep = 142 istep = 143 istep = 144 istep = 145 p = 1 5 12 22 35 51 70 92 117 145 d = 0 1 0 0 1 0 1 0 0 1 istep = 146 istep = 147 istep = 148 istep = 149 istep = 150 istep = 151 istep = 152 istep = 153 istep = 154 istep = 155 istep = 156 istep = 157 istep = 158 istep = 159 istep = 160 istep = 161 istep = 162 istep = 163 istep = 164 istep = 165 istep = 166 istep = 167 istep = 168 istep = 169 istep = 170 istep = 171 istep = 172 istep = 173 istep = 174 istep = 175 istep = 176 p = 1 5 12 22 35 51 70 92 117 145 176 d = 0 1 0 0 1 0 1 0 0 1 0 istep = 177 istep = 178 istep = 179 istep = 180 istep = 181 istep = 182 istep = 183 istep = 184 istep = 185 istep = 186 istep = 187 istep = 188 istep = 189 istep = 190 istep = 191 istep = 192 istep = 193 istep = 194 istep = 195 istep = 196 istep = 197 istep = 198 istep = 199 istep = 200 istep = 201 istep = 202 istep = 203 istep = 204 istep = 205 istep = 206 istep = 207 istep = 208 istep = 209 istep = 210 p = 1 5 12 22 35 51 70 92 117 145 176 210 d = 0 1 0 0 1 0 1 0 0 1 0 1 istep = 211 istep = 212 istep = 213 istep = 214 istep = 215 istep = 216 istep = 217 istep = 218 istep = 219 istep = 220 istep = 221 istep = 222 istep = 223 istep = 224 istep = 225 istep = 226 istep = 227 istep = 228 istep = 229 istep = 230 istep = 231 istep = 232 istep = 233 istep = 234 istep = 235 istep = 236 istep = 237 istep = 238 istep = 239 istep = 240 istep = 241 istep = 242 istep = 243 istep = 244 istep = 245 istep = 246 istep = 247 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 d = 0 1 0 0 1 0 1 0 0 1 0 1 0 istep = 248 istep = 249 istep = 250 istep = 251 istep = 252 istep = 253 istep = 254 istep = 255 istep = 256 istep = 257 istep = 258 istep = 259 istep = 260 istep = 261 istep = 262 istep = 263 istep = 264 istep = 265 istep = 266 istep = 267 istep = 268 istep = 269 istep = 270 istep = 271 istep = 272 istep = 273 istep = 274 istep = 275 istep = 276 istep = 277 istep = 278 istep = 279 istep = 280 istep = 281 istep = 282 istep = 283 istep = 284 istep = 285 istep = 286 istep = 287 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 d = 0 1 0 0 1 0 1 0 0 1 0 1 0 0 istep = 288 istep = 289 istep = 290 istep = 291 istep = 292 istep = 293 istep = 294 istep = 295 istep = 296 istep = 297 istep = 298 istep = 299 istep = 300 istep = 301 istep = 302 istep = 303 istep = 304 istep = 305 istep = 306 istep = 307 istep = 308 istep = 309 istep = 310 istep = 311 istep = 312 istep = 313 istep = 314 istep = 315 istep = 316 istep = 317 istep = 318 istep = 319 istep = 320 istep = 321 istep = 322 istep = 323 istep = 324 istep = 325 istep = 326 istep = 327 istep = 328 istep = 329 istep = 330 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 d = 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 istep = 331 istep = 332 istep = 333 istep = 334 istep = 335 istep = 336 istep = 337 istep = 338 istep = 339 istep = 340 istep = 341 istep = 342 istep = 343 istep = 344 istep = 345 istep = 346 istep = 347 istep = 348 istep = 349 istep = 350 istep = 351 istep = 352 istep = 353 istep = 354 istep = 355 istep = 356 istep = 357 istep = 358 istep = 359 istep = 360 istep = 361 istep = 362 istep = 363 istep = 364 istep = 365 istep = 366 istep = 367 istep = 368 istep = 369 istep = 370 istep = 371 istep = 372 istep = 373 istep = 374 istep = 375 istep = 376 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 d = 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 istep = 377 istep = 378 istep = 379 istep = 380 istep = 381 istep = 382 istep = 383 istep = 384 istep = 385 istep = 386 istep = 387 istep = 388 istep = 389 istep = 390 istep = 391 istep = 392 istep = 393 istep = 394 istep = 395 istep = 396 istep = 397 istep = 398 istep = 399 istep = 400 istep = 401 istep = 402 istep = 403 istep = 404 istep = 405 istep = 406 istep = 407 istep = 408 istep = 409 istep = 410 istep = 411 istep = 412 istep = 413 istep = 414 istep = 415 istep = 416 istep = 417 istep = 418 istep = 419 istep = 420 istep = 421 istep = 422 istep = 423 istep = 424 istep = 425 p = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 d = 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 istep = 426 istep = 427 istep = 428 istep = 429 istep = 430 istep = 431 istep = 432 istep = 433 istep = 434 istep = 435 istep = 436 istep = 437 istep = 438 istep = ...

10   Pass
x1 = 10000; x2 = 12000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[10045,10292,10542,10795,11051,11310,11572,11837])) assert(isequal(d,[1,0,0,1,0,1,0,0]))

istep = 10000 istep = 10001 istep = 10002 istep = 10003 istep = 10004 istep = 10005 istep = 10006 istep = 10007 istep = 10008 istep = 10009 istep = 10010 istep = 10011 istep = 10012 istep = 10013 istep = 10014 istep = 10015 istep = 10016 istep = 10017 istep = 10018 istep = 10019 istep = 10020 istep = 10021 istep = 10022 istep = 10023 istep = 10024 istep = 10025 istep = 10026 istep = 10027 istep = 10028 istep = 10029 istep = 10030 istep = 10031 istep = 10032 istep = 10033 istep = 10034 istep = 10035 istep = 10036 istep = 10037 istep = 10038 istep = 10039 istep = 10040 istep = 10041 istep = 10042 istep = 10043 istep = 10044 istep = 10045 p = 10045 d = 1 istep = 10046 istep = 10047 istep = 10048 istep = 10049 istep = 10050 istep = 10051 istep = 10052 istep = 10053 istep = 10054 istep = 10055 istep = 10056 istep = 10057 istep = 10058 istep = 10059 istep = 10060 istep = 10061 istep = 10062 istep = 10063 istep = 10064 istep = 10065 istep = 10066 istep = 10067 istep = 10068 istep = 10069 istep = 10070 istep = 10071 istep = 10072 istep = 10073 istep = 10074 istep = 10075 istep = 10076 istep = 10077 istep = 10078 istep = 10079 istep = 10080 istep = 10081 istep = 10082 istep = 10083 istep = 10084 istep = 10085 istep = 10086 istep = 10087 istep = 10088 istep = 10089 istep = 10090 istep = 10091 istep = 10092 istep = 10093 istep = 10094 istep = 10095 istep = 10096 istep = 10097 istep = 10098 istep = 10099 istep = 10100 istep = 10101 istep = 10102 istep = 10103 istep = 10104 istep = 10105 istep = 10106 istep = 10107 istep = 10108 istep = 10109 istep = 10110 istep = 10111 istep = 10112 istep = 10113 istep = 10114 istep = 10115 istep = 10116 istep = 10117 istep = 10118 istep = 10119 istep = 10120 istep = 10121 istep = 10122 istep = 10123 istep = 10124 istep = 10125 istep = 10126 istep = 10127 istep = 10128 istep = 10129 istep = 10130 istep = 10131 istep = 10132 istep = 10133 istep = 10134 istep = 10135 istep = 10136 istep = 10137 istep = 10138 istep = 10139 istep = 10140 istep = 10141 istep = 10142 istep = 10143 istep = 10144 istep = 10145 istep = 10146 istep = 10147 istep = 10148 istep = 10149 istep = 10150 istep = 10151 istep = 10152 istep = 10153 istep = 10154 istep = 10155 istep = 10156 istep = 10157 istep = 10158 istep = 10159 istep = 10160 istep = 10161 istep = 10162 istep = 10163 istep = 10164 istep = 10165 istep = 10166 istep = 10167 istep = 10168 istep = 10169 istep = 10170 istep = 10171 istep = 10172 istep = 10173 istep = 10174 istep = 10175 istep = 10176 istep = 10177 istep = 10178 istep = 10179 istep = 10180 istep = 10181 istep = 10182 istep = 10183 istep = 10184 istep = 10185 istep = 10186 istep = 10187 istep = 10188 istep = 10189 istep = 10190 istep = 10191 istep = 10192 istep = 10193 istep = 10194 istep = 10195 istep = 10196 istep = 10197 istep = 10198 istep = 10199 istep = 10200 istep = 10201 istep = 10202 istep = 10203 istep = 10204 istep = 10205 istep = 10206 istep = 10207 istep = 10208 istep = 10209 istep = 10210 istep = 10211 istep = 10212 istep = 10213 istep = 10214 istep = 10215 istep = 10216 istep = 10217 istep = 10218 istep = 10219 istep = 10220 istep = 10221 istep = 10222 istep = 10223 istep = 10224 istep = 10225 istep = 10226 istep = 10227 istep = 10228 istep = 10229 istep = 10230 istep = 10231 istep = 10232 istep = 10233 istep = 10234 istep = 10235 istep = 10236 istep = 10237 istep = 10238 istep = 10239 istep = 10240 istep = 10241 istep = 10242 istep = 10243 istep = 10244 istep = 10245 istep = 10246 istep = 10247 istep = 10248 istep = 10249 istep = 10250 istep = 10251 istep = 10252 istep = 10253 istep = 10254 istep = 10255 istep = 10256 istep = 10257 istep = 10258 istep = 10259 istep = 10260 istep = 10261 istep = 10262 istep = 10263 istep = 10264 istep = 10265 istep = 10266 istep = 10267 istep = 10268 istep = 10269 istep = 10270 istep = 10271 istep = 10272 istep = 10273 istep = 10274 istep = 10275 istep = 10276 istep = 10277 istep = 10278 istep = 10279 istep = 10280 istep = 10281 istep = 10282 istep = 10283 istep = 10284 istep = 10285 istep = 10286 istep = 10287 istep = 10288 istep = 10289 istep = 10290 istep = 10291 istep = 10292 p = 10045 10292 d = 1 0 istep = 10293 istep = 10294 istep = 10295 istep = 10296 istep = 10297 istep = 10298 istep = 10299 istep = 10300 istep = 10301 istep = 10302 istep = 10303 istep = 10304 istep = 10305 istep = 10306 istep = 10307 istep = 10308 istep = 10309 istep = 10310 istep = 10311 istep = 10312 istep = 10313 istep = 10314 istep = 10315 istep = 10316 istep = 10317 istep = 10318 istep = 10319 istep = 10320 istep = 10321 istep = 10322 istep = 10323 istep = 10324 istep = 10325 istep = 10326 istep = 10327 istep = 10328 istep = 10329 istep = 10330 istep = 10331 istep = 10332 istep = 10333 istep = 10334 istep = 10335 istep = 10336 istep = 10337 istep = 10338 istep = 10339 istep = 10340 istep = 10341 istep = 10342 istep = 10343 istep = 10344 istep = 10345 istep = 10346 istep = 10347 istep = 10348 istep = 10349 istep = 10350 istep = 10351 istep = 10352 istep = 10353 istep = 10354 istep = 10355 istep = 10356 istep = 10357 istep = 10358 istep = 10359 istep = 10360 istep = 10361 istep = 10362 istep = 10363 istep = 10364 istep = 10365 istep = 10366 istep = 10367 istep = 10368 istep = 10369 istep = 10370 istep = 10371 istep = 10372 istep = 10373 istep = 10374 istep = 10375 istep = 10376 istep = 10377 istep = 10378 istep = 10379 istep = 10380 istep = 10381 istep = 10382 istep = 10383 istep = 10384 istep = 10385 istep = 10386 istep = 10387 istep = 10388 istep = 10389 istep = 10390 istep = 10391 istep = 10392 istep = 10393 istep = 10394 istep = 10395 istep = 10396 istep = 10397 istep = 10398 istep = 10399 istep = 10400 istep = 10401 istep = 10402 istep = 10403 istep = 10404 istep = 10405 istep = 10406 istep = 10407 istep = 10408 istep = 10409 istep = 10410 istep = 10411 istep = 10412 is...

11   Pass
x1 = 100000; x2 = 110000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[100492,101270,102051,102835,103622,104412,105205,106001,106800,107602,108407,109215])) assert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1]))

istep = 100000 istep = 100001 istep = 100002 istep = 100003 istep = 100004 istep = 100005 istep = 100006 istep = 100007 istep = 100008 istep = 100009 istep = 100010 istep = 100011 istep = 100012 istep = 100013 istep = 100014 istep = 100015 istep = 100016 istep = 100017 istep = 100018 istep = 100019 istep = 100020 istep = 100021 istep = 100022 istep = 100023 istep = 100024 istep = 100025 istep = 100026 istep = 100027 istep = 100028 istep = 100029 istep = 100030 istep = 100031 istep = 100032 istep = 100033 istep = 100034 istep = 100035 istep = 100036 istep = 100037 istep = 100038 istep = 100039 istep = 100040 istep = 100041 istep = 100042 istep = 100043 istep = 100044 istep = 100045 istep = 100046 istep = 100047 istep = 100048 istep = 100049 istep = 100050 istep = 100051 istep = 100052 istep = 100053 istep = 100054 istep = 100055 istep = 100056 istep = 100057 istep = 100058 istep = 100059 istep = 100060 istep = 100061 istep = 100062 istep = 100063 istep = 100064 istep = 100065 istep = 100066 istep = 100067 istep = 100068 istep = 100069 istep = 100070 istep = 100071 istep = 100072 istep = 100073 istep = 100074 istep = 100075 istep = 100076 istep = 100077 istep = 100078 istep = 100079 istep = 100080 istep = 100081 istep = 100082 istep = 100083 istep = 100084 istep = 100085 istep = 100086 istep = 100087 istep = 100088 istep = 100089 istep = 100090 istep = 100091 istep = 100092 istep = 100093 istep = 100094 istep = 100095 istep = 100096 istep = 100097 istep = 100098 istep = 100099 istep = 100100 istep = 100101 istep = 100102 istep = 100103 istep = 100104 istep = 100105 istep = 100106 istep = 100107 istep = 100108 istep = 100109 istep = 100110 istep = 100111 istep = 100112 istep = 100113 istep = 100114 istep = 100115 istep = 100116 istep = 100117 istep = 100118 istep = 100119 istep = 100120 istep = 100121 istep = 100122 istep = 100123 istep = 100124 istep = 100125 istep = 100126 istep = 100127 istep = 100128 istep = 100129 istep = 100130 istep = 100131 istep = 100132 istep = 100133 istep = 100134 istep = 100135 istep = 100136 istep = 100137 istep = 100138 istep = 100139 istep = 100140 istep = 100141 istep = 100142 istep = 100143 istep = 100144 istep = 100145 istep = 100146 istep = 100147 istep = 100148 istep = 100149 istep = 100150 istep = 100151 istep = 100152 istep = 100153 istep = 100154 istep = 100155 istep = 100156 istep = 100157 istep = 100158 istep = 100159 istep = 100160 istep = 100161 istep = 100162 istep = 100163 istep = 100164 istep = 100165 istep = 100166 istep = 100167 istep = 100168 istep = 100169 istep = 100170 istep = 100171 istep = 100172 istep = 100173 istep = 100174 istep = 100175 istep = 100176 istep = 100177 istep = 100178 istep = 100179 istep = 100180 istep = 100181 istep = 100182 istep = 100183 istep = 100184 istep = 100185 istep = 100186 istep = 100187 istep = 100188 istep = 100189 istep = 100190 istep = 100191 istep = 100192 istep = 100193 istep = 100194 istep = 100195 istep = 100196 istep = 100197 istep = 100198 istep = 100199 istep = 100200 istep = 100201 istep = 100202 istep = 100203 istep = 100204 istep = 100205 istep = 100206 istep = 100207 istep = 100208 istep = 100209 istep = 100210 istep = 100211 istep = 100212 istep = 100213 istep = 100214 istep = 100215 istep = 100216 istep = 100217 istep = 100218 istep = 100219 istep = 100220 istep = 100221 istep = 100222 istep = 100223 istep = 100224 istep = 100225 istep = 100226 istep = 100227 istep = 100228 istep = 100229 istep = 100230 istep = 100231 istep = 100232 istep = 100233 istep = 100234 istep = 100235 istep = 100236 istep = 100237 istep = 100238 istep = 100239 istep = 100240 istep = 100241 istep = 100242 istep = 100243 istep = 100244 istep = 100245 istep = 100246 istep = 100247 istep = 100248 istep = 100249 istep = 100250 istep = 100251 istep = 100252 istep = 100253 istep = 100254 istep = 100255 istep = 100256 istep = 100257 istep = 100258 istep = 100259 istep = 100260 istep = 100261 istep = 100262 istep = 100263 istep = 100264 istep = 100265 istep = 100266 istep = 100267 istep = 100268 istep = 100269 istep = 100270 istep = 100271 istep = 100272 istep = 100273 istep = 100274 istep = 100275 istep = 100276 istep = 100277 istep = 100278 istep = 100279 istep = 100280 istep = 100281 istep = 100282 istep = 100283 istep = 100284 istep = 100285 istep = 100286 istep = 100287 istep = 100288 istep = 100289 istep = 100290 istep = 100291 istep = 100292 istep = 100293 istep = 100294 istep = 100295 istep = 100296 istep = 100297 istep = 100298 istep = 100299 istep = 100300 istep = 100301 istep = 100302 istep = 100303 istep = 100304 istep = 100305 istep = 100306 istep = 100307 istep = 100308 istep = 100309 istep = 100310 istep = 100311 istep = 100312 istep = 100313 istep = 100314 istep = 100315 istep = 100316 istep = 100317 istep = 100318 istep = 100319 istep = 100320 istep = 100321 istep = 100322 istep = 100323 istep = 100324 istep = 100325 istep = 100326 istep = 100327 istep = 100328 istep = 100329 istep = 100330 istep = 100331 istep = 100332 istep = 100333 istep = 100334 istep = 100335 istep = 100336 istep = 100337 istep = 100338 istep = 100339 istep = 100340 istep = 100341 istep = 100342 istep = 100343 istep = 100344 istep = 100345 istep = 100346 istep = 100347 istep = 100348 istep = 100349 istep = 100350 istep = 100351 istep = 100352 istep = 100353 istep = 100354 istep = 100355 istep = 100356 istep = 100357 istep = 100358 istep = 100359 istep = 100360 istep = 100361 istep = 100362 istep = 100363 istep = 100364 istep = 100365 istep = 100366 istep = 100367 istep = 100368 istep = 100369 istep = 100370 istep = 100371 istep = 100372 istep = 100373 istep = 100374 istep = 100375 istep = 100376 istep = 100377 istep = 100378 istep = 100379 istep = 100380 istep = 100381 istep = 100382 istep = 100383 istep = 100384 istep = 100385 istep = 100386 istep = 100387 istep = 100388 istep = 100389 istep = 100390 istep = 100391 istep = 100392 istep = 100393 istep = 100394 istep = 100395 istep = 100396 istep = 100397 istep = 100398 istep = 100399 istep = 100400 istep = 100401 istep = 100402 istep = 100403 istep = 100404 istep = 100405 istep = 100406 istep = 100407 istep = 100408 istep = 100409 istep = 100410 istep = 100411 istep = 100412 istep = 100413 istep = 100414 istep = 100415 istep = 1...

12   Pass
x1 = 1000000; x2 = 1010101; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1000825,1003277,1005732,1008190])) assert(isequal(d,[1,0,0,1]))

istep = 1000000 istep = 1000001 istep = 1000002 istep = 1000003 istep = 1000004 istep = 1000005 istep = 1000006 istep = 1000007 istep = 1000008 istep = 1000009 istep = 1000010 istep = 1000011 istep = 1000012 istep = 1000013 istep = 1000014 istep = 1000015 istep = 1000016 istep = 1000017 istep = 1000018 istep = 1000019 istep = 1000020 istep = 1000021 istep = 1000022 istep = 1000023 istep = 1000024 istep = 1000025 istep = 1000026 istep = 1000027 istep = 1000028 istep = 1000029 istep = 1000030 istep = 1000031 istep = 1000032 istep = 1000033 istep = 1000034 istep = 1000035 istep = 1000036 istep = 1000037 istep = 1000038 istep = 1000039 istep = 1000040 istep = 1000041 istep = 1000042 istep = 1000043 istep = 1000044 istep = 1000045 istep = 1000046 istep = 1000047 istep = 1000048 istep = 1000049 istep = 1000050 istep = 1000051 istep = 1000052 istep = 1000053 istep = 1000054 istep = 1000055 istep = 1000056 istep = 1000057 istep = 1000058 istep = 1000059 istep = 1000060 istep = 1000061 istep = 1000062 istep = 1000063 istep = 1000064 istep = 1000065 istep = 1000066 istep = 1000067 istep = 1000068 istep = 1000069 istep = 1000070 istep = 1000071 istep = 1000072 istep = 1000073 istep = 1000074 istep = 1000075 istep = 1000076 istep = 1000077 istep = 1000078 istep = 1000079 istep = 1000080 istep = 1000081 istep = 1000082 istep = 1000083 istep = 1000084 istep = 1000085 istep = 1000086 istep = 1000087 istep = 1000088 istep = 1000089 istep = 1000090 istep = 1000091 istep = 1000092 istep = 1000093 istep = 1000094 istep = 1000095 istep = 1000096 istep = 1000097 istep = 1000098 istep = 1000099 istep = 1000100 istep = 1000101 istep = 1000102 istep = 1000103 istep = 1000104 istep = 1000105 istep = 1000106 istep = 1000107 istep = 1000108 istep = 1000109 istep = 1000110 istep = 1000111 istep = 1000112 istep = 1000113 istep = 1000114 istep = 1000115 istep = 1000116 istep = 1000117 istep = 1000118 istep = 1000119 istep = 1000120 istep = 1000121 istep = 1000122 istep = 1000123 istep = 1000124 istep = 1000125 istep = 1000126 istep = 1000127 istep = 1000128 istep = 1000129 istep = 1000130 istep = 1000131 istep = 1000132 istep = 1000133 istep = 1000134 istep = 1000135 istep = 1000136 istep = 1000137 istep = 1000138 istep = 1000139 istep = 1000140 istep = 1000141 istep = 1000142 istep = 1000143 istep = 1000144 istep = 1000145 istep = 1000146 istep = 1000147 istep = 1000148 istep = 1000149 istep = 1000150 istep = 1000151 istep = 1000152 istep = 1000153 istep = 1000154 istep = 1000155 istep = 1000156 istep = 1000157 istep = 1000158 istep = 1000159 istep = 1000160 istep = 1000161 istep = 1000162 istep = 1000163 istep = 1000164 istep = 1000165 istep = 1000166 istep = 1000167 istep = 1000168 istep = 1000169 istep = 1000170 istep = 1000171 istep = 1000172 istep = 1000173 istep = 1000174 istep = 1000175 istep = 1000176 istep = 1000177 istep = 1000178 istep = 1000179 istep = 1000180 istep = 1000181 istep = 1000182 istep = 1000183 istep = 1000184 istep = 1000185 istep = 1000186 istep = 1000187 istep = 1000188 istep = 1000189 istep = 1000190 istep = 1000191 istep = 1000192 istep = 1000193 istep = 1000194 istep = 1000195 istep = 1000196 istep = 1000197 istep = 1000198 istep = 1000199 istep = 1000200 istep = 1000201 istep = 1000202 istep = 1000203 istep = 1000204 istep = 1000205 istep = 1000206 istep = 1000207 istep = 1000208 istep = 1000209 istep = 1000210 istep = 1000211 istep = 1000212 istep = 1000213 istep = 1000214 istep = 1000215 istep = 1000216 istep = 1000217 istep = 1000218 istep = 1000219 istep = 1000220 istep = 1000221 istep = 1000222 istep = 1000223 istep = 1000224 istep = 1000225 istep = 1000226 istep = 1000227 istep = 1000228 istep = 1000229 istep = 1000230 istep = 1000231 istep = 1000232 istep = 1000233 istep = 1000234 istep = 1000235 istep = 1000236 istep = 1000237 istep = 1000238 istep = 1000239 istep = 1000240 istep = 1000241 istep = 1000242 istep = 1000243 istep = 1000244 istep = 1000245 istep = 1000246 istep = 1000247 istep = 1000248 istep = 1000249 istep = 1000250 istep = 1000251 istep = 1000252 istep = 1000253 istep = 1000254 istep = 1000255 istep = 1000256 istep = 1000257 istep = 1000258 istep = 1000259 istep = 1000260 istep = 1000261 istep = 1000262 istep = 1000263 istep = 1000264 istep = 1000265 istep = 1000266 istep = 1000267 istep = 1000268 istep = 1000269 istep = 1000270 istep = 1000271 istep = 1000272 istep = 1000273 istep = 1000274 istep = 1000275 istep = 1000276 istep = 1000277 istep = 1000278 istep = 1000279 istep = 1000280 istep = 1000281 istep = 1000282 istep = 1000283 istep = 1000284 istep = 1000285 istep = 1000286 istep = 1000287 istep = 1000288 istep = 1000289 istep = 1000290 istep = 1000291 istep = 1000292 istep = 1000293 istep = 1000294 istep = 1000295 istep = 1000296 istep = 1000297 istep = 1000298 istep = 1000299 istep = 1000300 istep = 1000301 istep = 1000302 istep = 1000303 istep = 1000304 istep = 1000305 istep = 1000306 istep = 1000307 istep = 1000308 istep = 1000309 istep = 1000310 istep = 1000311 istep = 1000312 istep = 1000313 istep = 1000314 istep = 1000315 istep = 1000316 istep = 1000317 istep = 1000318 istep = 1000319 istep = 1000320 istep = 1000321 istep = 1000322 istep = 1000323 istep = 1000324 istep = 1000325 istep = 1000326 istep = 1000327 istep = 1000328 istep = 1000329 istep = 1000330 istep = 1000331 istep = 1000332 istep = 1000333 istep = 1000334 istep = 1000335 istep = 1000336 istep = 1000337 istep = 1000338 istep = 1000339 istep = 1000340 istep = 1000341 istep = 1000342 istep = 1000343 istep = 1000344 istep = 1000345 istep = 1000346 istep = 1000347 istep = 1000348 istep = 1000349 istep = 1000350 istep = 1000351 istep = 1000352 istep = 1000353 istep = 1000354 istep = 1000355 istep = 1000356 istep = 1000357 istep = 1000358 istep = 1000359 istep = 1000360 istep = 1000361 istep = 1000362 istep = 1000363 istep = 1000364 istep = 1000365 istep = 1000366 istep = 1000367 istep = 1000368 istep = 1000369 istep = 1000370 istep = 1000371 istep = 1000372 istep = 1000373 istep = 1000374 istep = 1000375 istep = 1000376 istep = 1000377 istep = 1000378 istep = 1000379 istep = 1000380 istep = 1000381 istep = 1000382 istep = 1000383 istep = 1000384 istep = 1000385 istep = 1000386 istep = 1000387 istep = 1000388 istep = 1000389 istep = 1000390 istep = 1000391 istep = 1000392 istep = 1000393 istep = 1000394 istep = 1000395 istep = 1000396 istep = 1000397 istep = 1000398 istep = 1000399 istep = 1000400 istep = 1000401 istep = 1000402 istep = 1000403 istep = 1000404 istep = 1000405 istep = 1000406 istep = 1000407 istep = 1000408 istep = 1000409 istep = 1000410 istep = 1000411 istep = 1000412 istep = 1000413 istep = 1000414 istep = 1000415 istep = 10...