Cody

Solution 838361

Submitted on 25 Feb 2016 by Guillaume
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 = 9; y_correct = 6; assert(isequal(odd_elimination(n),y_correct))

y = 8 6 4 2 y = 2 6 y = 6

2   Pass
n = 1000; y_correct = 510; assert(isequal(odd_elimination(n),y_correct))

y = Columns 1 through 15 1000 998 996 994 992 990 988 986 984 982 980 978 976 974 972 Columns 16 through 30 970 968 966 964 962 960 958 956 954 952 950 948 946 944 942 Columns 31 through 45 940 938 936 934 932 930 928 926 924 922 920 918 916 914 912 Columns 46 through 60 910 908 906 904 902 900 898 896 894 892 890 888 886 884 882 Columns 61 through 75 880 878 876 874 872 870 868 866 864 862 860 858 856 854 852 Columns 76 through 90 850 848 846 844 842 840 838 836 834 832 830 828 826 824 822 Columns 91 through 105 820 818 816 814 812 810 808 806 804 802 800 798 796 794 792 Columns 106 through 120 790 788 786 784 782 780 778 776 774 772 770 768 766 764 762 Columns 121 through 135 760 758 756 754 752 750 748 746 744 742 740 738 736 734 732 Columns 136 through 150 730 728 726 724 722 720 718 716 714 712 710 708 706 704 702 Columns 151 through 165 700 698 696 694 692 690 688 686 684 682 680 678 676 674 672 Columns 166 through 180 670 668 666 664 662 660 658 656 654 652 650 648 646 644 642 Columns 181 through 195 640 638 636 634 632 630 628 626 624 622 620 618 616 614 612 Columns 196 through 210 610 608 606 604 602 600 598 596 594 592 590 588 586 584 582 Columns 211 through 225 580 578 576 574 572 570 568 566 564 562 560 558 556 554 552 Columns 226 through 240 550 548 546 544 542 540 538 536 534 532 530 528 526 524 522 Columns 241 through 255 520 518 516 514 512 510 508 506 504 502 500 498 496 494 492 Columns 256 through 270 490 488 486 484 482 480 478 476 474 472 470 468 466 464 462 Columns 271 through 285 460 458 456 454 452 450 448 446 444 442 440 438 436 434 432 Columns 286 through 300 430 428 426 424 422 420 418 416 414 412 410 408 406 404 402 Columns 301 through 315 400 398 396 394 392 390 388 386 384 382 380 378 376 374 372 Columns 316 through 330 370 368 366 364 362 360 358 356 354 352 350 348 346 344 342 Columns 331 through 345 340 338 336 334 332 330 328 326 324 322 320 318 316 314 312 Columns 346 through 360 310 308 306 304 302 300 298 296 294 292 290 288 286 284 282 Columns 361 through 375 280 278 276 274 272 270 268 266 264 262 260 258 256 254 252 Columns 376 through 390 250 248 246 244 242 240 238 236 234 232 230 228 226 224 222 Columns 391 through 405 220 218 216 214 212 210 208 206 204 202 200 198 196 194 192 Columns 406 through 420 190 188 186 184 182 180 178 176 174 172 170 168 166 164 162 Columns 421 through 435 160 158 156 154 152 150 148 146 144 142 140 138 136 134 132 Columns 436 through 450 130 128 126 124 122 120 118 116 114 112 110 108 106 104 102 Columns 451 through 465 100 98 96 94 92 90 88 86 84 82 80 78 76 74 72 Columns 466 through 480 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 Columns 481 through 495 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 Columns 496 through 500 10 8 6 4 2 y = Columns 1 through 30 2 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82 86 90 94 98 102 106 110 114 118 Columns 31 through 60 122 126 130 134 138 142 146 150 154 158 162 166 170 174 178 182 186 190 194 198 202 206 210 214 218 222 226 230 234 238 Columns 61 through 90 242 246 250 254 258 262 266 270 274 278 282 286 290 294 298 302 306 310 314 318 322 326 330 334 338 342 346 350 354 358 Columns 91 through 120 362 366 370 374 378 382 386 390 394 398 402 406 410 414 418 422 426 430 434 438 442 446 450 454 458 462 466 470 474 478 Columns 121 through 150 482 486 490 494 498 502 506 510 514 518 522 526 530 534 538 542 546 550 554 558 562 566 570 574 578 582 586 590 594 598 Columns 151 through 180 602 606 610 614 618 622 626 630 634 638 642 646 650 654 658 662 666 670 674 678 682 686 690 694 698 702 706 710 714 718 Columns 181 through 210 722 726 730 734 738 742 746 750 754 758 762 766 770 774 778 782 786 790 794 798 802 806 810 814 818 822 826 830 834 838 Columns 211 through 240 842 846 850 854 858 862 866 870 874 878 882 886 890 894 898 902 906 910 914 918 922 926 930 934 938 942 946 950 954 958 Columns 241 through 250 962 966 970 974 978 982 986 990 994 998 y = Columns 1 through 30 998 990 982 974 966 958 950 942 934 926 918 910 902 894 886 878 870 862 854 846 838 830 822 814 806 798 790 782 774 766 Columns 31 through 60 758 750 742 734 726 718 710 702 694 686 678 670 662 654 646 638 630 622 614 606 598 590 582 574 566 558 550 542 534 526 Columns 61 through 90 518 510 502 494 486 478 470 462 454 446 438 430 422 414 406 398 390 382 374 366 358 350 342 334 326 318 310 302 294 286 Columns 91 through 120 278 270 262 254 246 238 230 222 214 206 198 190 182 174 166 158 150 142 134 126 118 110 102 94 86 78 70 62 54 46 Columns 121 through 125 38 30 22 14 6 y = Columns 1 through 30 14 30 46 62 78 94 110 126 142 158 174 190 206 222 238 254 270 286 302 318 334 350 366 382 398 414 430 446 462 478 Columns 31 through 60 494 510 526 542 558 574 590 606 622 638 654 670 686 702 718 734 750 766 782 798 814 830 ...

3   Pass
n = 99; y_correct = 56; assert(isequal(odd_elimination(n),y_correct))

y = Columns 1 through 30 98 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 Columns 31 through 49 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2 y = 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 y = 96 88 80 72 64 56 48 40 32 24 16 8 y = 8 24 40 56 72 88 y = 88 56 24 y = 56

4   Pass
n = 5000; y_correct = 2014; assert(isequal(odd_elimination(n),y_correct))

y = Columns 1 through 15 5000 4998 4996 4994 4992 4990 4988 4986 4984 4982 4980 4978 4976 4974 4972 Columns 16 through 30 4970 4968 4966 4964 4962 4960 4958 4956 4954 4952 4950 4948 4946 4944 4942 Columns 31 through 45 4940 4938 4936 4934 4932 4930 4928 4926 4924 4922 4920 4918 4916 4914 4912 Columns 46 through 60 4910 4908 4906 4904 4902 4900 4898 4896 4894 4892 4890 4888 4886 4884 4882 Columns 61 through 75 4880 4878 4876 4874 4872 4870 4868 4866 4864 4862 4860 4858 4856 4854 4852 Columns 76 through 90 4850 4848 4846 4844 4842 4840 4838 4836 4834 4832 4830 4828 4826 4824 4822 Columns 91 through 105 4820 4818 4816 4814 4812 4810 4808 4806 4804 4802 4800 4798 4796 4794 4792 Columns 106 through 120 4790 4788 4786 4784 4782 4780 4778 4776 4774 4772 4770 4768 4766 4764 4762 Columns 121 through 135 4760 4758 4756 4754 4752 4750 4748 4746 4744 4742 4740 4738 4736 4734 4732 Columns 136 through 150 4730 4728 4726 4724 4722 4720 4718 4716 4714 4712 4710 4708 4706 4704 4702 Columns 151 through 165 4700 4698 4696 4694 4692 4690 4688 4686 4684 4682 4680 4678 4676 4674 4672 Columns 166 through 180 4670 4668 4666 4664 4662 4660 4658 4656 4654 4652 4650 4648 4646 4644 4642 Columns 181 through 195 4640 4638 4636 4634 4632 4630 4628 4626 4624 4622 4620 4618 4616 4614 4612 Columns 196 through 210 4610 4608 4606 4604 4602 4600 4598 4596 4594 4592 4590 4588 4586 4584 4582 Columns 211 through 225 4580 4578 4576 4574 4572 4570 4568 4566 4564 4562 4560 4558 4556 4554 4552 Columns 226 through 240 4550 4548 4546 4544 4542 4540 4538 4536 4534 4532 4530 4528 4526 4524 4522 Columns 241 through 255 4520 4518 4516 4514 4512 4510 4508 4506 4504 4502 4500 4498 4496 4494 4492 Columns 256 through 270 4490 4488 4486 4484 4482 4480 4478 4476 4474 4472 4470 4468 4466 4464 4462 Columns 271 through 285 4460 4458 4456 4454 4452 4450 4448 4446 4444 4442 4440 4438 4436 4434 4432 Columns 286 through 300 4430 4428 4426 4424 4422 4420 4418 4416 4414 4412 4410 4408 4406 4404 4402 Columns 301 through 315 4400 4398 4396 4394 4392 4390 4388 4386 4384 4382 4380 4378 4376 4374 4372 Columns 316 through 330 4370 4368 4366 4364 4362 4360 4358 4356 4354 4352 4350 4348 4346 4344 4342 Columns 331 through 345 4340 4338 4336 4334 4332 4330 4328 4326 4324 4322 4320 4318 4316 4314 4312 Columns 346 through 360 4310 4308 4306 4304 4302 4300 4298 4296 4294 4292 4290 4288 4286 4284 4282 Columns 361 through 375 4280 4278 4276 4274 4272 4270 4268 4266 4264 4262 4260 4258 4256 4254 4252 Columns 376 through 390 4250 4248 4246 4244 4242 4240 4238 4236 4234 4232 4230 4228 4226 4224 4222 Columns 391 through 405 4220 4218 4216 4214 4212 4210 4208 4206 4204 4202 4200 4198 4196 4194 4192 Columns 406 through 420 4190 4188 4186 4184 4182 4180 4178 4176 4174 4172 4170 4168 4166 4164 4162 Columns 421 through 435 4160 4158 4156 4154 4152 4150 4148 4146 4144 4142 4140 4138 4136 4134 4132 Columns 436 through 450 4130 4128 4126 4124 4122 4120 4118 4116 4114 4112 4110 4108 4106 4104 4102 Columns 451 through 465 4100 4098 4096 4094 4092 4090 4088 4086 4084 4082 4080 4078 4076 4074 4072 Columns 466 through 480 4070 4068 4066 4064 4062 4060 4058 4056 4054 4052 4050 4048 4046 4044 4042 Columns 481 through 495 4040 4038 4036 4034 4032 4030 4028 4026 4024 4022 4020 4018 4016 4014 4012 Columns 496 through 510 4010 4008 4006 4004 4002 4000 3998 3996 3994 3992 3990 3988 3986 3984 3982 Columns 511 through 525 3980 3978 3976 3974 3972 3970 3968 3966 3964 3962 3960 3958 3956 3954 3952 Columns 526 through 540 3950 3948 3946 3944 3942 3940 3938 3936 3934 3932 3930 3928 3926 3924 3922 Columns 541 through 555 3920 3918 3916 3914 3912 3910 3908 3906 3904 3902 3900 3898 3896 3894 3892 Columns 556 through 570 3890 3888 3886 3884 3882 3880 3878 3876 3874 3872 3870 3868 3866 3864 3862 Columns 571 through 585 3860 3858 3856 3854 3852 3850 3848 3846 3844 3842 3840 3838 3836 3834 3832 Columns 586 through 600 3830 3828 3826 3824 3822 3820 3818 3816 3814 3812 3810 3808 3806 3804 3802 Columns 601 through 615 3800 3798 3796 3794 3792 3790 3788 3786 3784 3782 3780 3778 3776 3774 3772 Columns 616 through 630 3770 3768 3766 3764 3762 3760 3758 3756 3754 3752 3750 3748 3746 3744 3742 Columns 631 through 645 3740 3738 3736 3734 3732 3730 3728 3726 3724 3722 3720 3718 3716 3714 3712 Columns 646 through 660 3710 3708 3706 3704 3702 3700 3698 3696 3694 3692 3690 3688 3686 3684 3682 Columns 661 through 675 3680 3678 3676 3674 3672 3670 3668 3666 3664 3662 3660 3658 3656 3654 3652 Columns 676 through 690 3650 3648 3646 3644 3642 3640 3638 3636 3634 3632 3630 3628 3626 3624 3622 Columns 691 through 705 3620 3618 3616 3614 3612 3610 3608 3606 3604 3602 3600 3598 3596 3594 3592 Columns 706 through 720 3590 3588 3586 3584 3582 3580 3578 3576 3574 3572 3570 3568 3566 ...

5   Pass
n = 100000; y_correct = 55286; assert(isequal(odd_elimination(n),y_correct))

y = Columns 1 through 15 100000 99998 99996 99994 99992 99990 99988 99986 99984 99982 99980 99978 99976 99974 99972 Columns 16 through 30 99970 99968 99966 99964 99962 99960 99958 99956 99954 99952 99950 99948 99946 99944 99942 Columns 31 through 45 99940 99938 99936 99934 99932 99930 99928 99926 99924 99922 99920 99918 99916 99914 99912 Columns 46 through 60 99910 99908 99906 99904 99902 99900 99898 99896 99894 99892 99890 99888 99886 99884 99882 Columns 61 through 75 99880 99878 99876 99874 99872 99870 99868 99866 99864 99862 99860 99858 99856 99854 99852 Columns 76 through 90 99850 99848 99846 99844 99842 99840 99838 99836 99834 99832 99830 99828 99826 99824 99822 Columns 91 through 105 99820 99818 99816 99814 99812 99810 99808 99806 99804 99802 99800 99798 99796 99794 99792 Columns 106 through 120 99790 99788 99786 99784 99782 99780 99778 99776 99774 99772 99770 99768 99766 99764 99762 Columns 121 through 135 99760 99758 99756 99754 99752 99750 99748 99746 99744 99742 99740 99738 99736 99734 99732 Columns 136 through 150 99730 99728 99726 99724 99722 99720 99718 99716 99714 99712 99710 99708 99706 99704 99702 Columns 151 through 165 99700 99698 99696 99694 99692 99690 99688 99686 99684 99682 99680 99678 99676 99674 99672 Columns 166 through 180 99670 99668 99666 99664 99662 99660 99658 99656 99654 99652 99650 99648 99646 99644 99642 Columns 181 through 195 99640 99638 99636 99634 99632 99630 99628 99626 99624 99622 99620 99618 99616 99614 99612 Columns 196 through 210 99610 99608 99606 99604 99602 99600 99598 99596 99594 99592 99590 99588 99586 99584 99582 Columns 211 through 225 99580 99578 99576 99574 99572 99570 99568 99566 99564 99562 99560 99558 99556 99554 99552 Columns 226 through 240 99550 99548 99546 99544 99542 99540 99538 99536 99534 99532 99530 99528 99526 99524 99522 Columns 241 through 255 99520 99518 99516 99514 99512 99510 99508 99506 99504 99502 99500 99498 99496 99494 99492 Columns 256 through 270 99490 99488 99486 99484 99482 99480 99478 99476 99474 99472 99470 99468 99466 99464 99462 Columns 271 through 285 99460 99458 99456 99454 99452 99450 99448 99446 99444 99442 99440 99438 99436 99434 99432 Columns 286 through 300 99430 99428 99426 99424 99422 99420 99418 99416 99414 99412 99410 99408 99406 99404 99402 Columns 301 through 315 99400 99398 99396 99394 99392 99390 99388 99386 99384 99382 99380 99378 99376 99374 99372 Columns 316 through 330 99370 99368 99366 99364 99362 99360 99358 99356 99354 99352 99350 99348 99346 99344 99342 Columns 331 through 345 99340 99338 99336 99334 99332 99330 99328 99326 99324 99322 99320 99318 99316 99314 99312 Columns 346 through 360 99310 99308 99306 99304 99302 99300 99298 99296 99294 99292 99290 99288 99286 99284 99282 Columns 361 through 375 99280 99278 99276 99274 99272 99270 99268 99266 99264 99262 99260 99258 99256 99254 99252 Columns 376 through 390 99250 99248 99246 99244 99242 99240 99238 99236 99234 99232 99230 99228 99226 99224 99222 Columns 391 through 405 99220 99218 99216 99214 99212 99210 99208 99206 99204 99202 99200 99198 99196 99194 99192 Columns 406 through 420 99190 99188 99186 99184 99182 99180 99178 99176 99174 99172 99170 99168 99166 99164 99162 Columns 421 through 435 99160 99158 99156 99154 99152 99150 99148 99146 99144 99142 99140 99138 99136 99134 99132 Columns 436 through 450 99130 99128 99126 99124 99122 99120 99118 99116 99114 99112 99110 99108 99106 99104 99102 Columns 451 through 465 99100 99098 99096 99094 99092 99090 99088 99086 99084 99082 99080 99078 99076 99074 99072 Columns 466 through 480 99070 99068 99066 99064 99062 99060 99058 99056 99054 99052 99050 99048 99046 99044 99042 Columns 481 through 495 99040 99038 99036 99034 99032 99030 99028 99026 99024 99022 99020 99018 99016 99014 99012 Columns 496 through 510 99010 99008 99006 99004 99002 99000 98998 98996 98994 98992 98990 98988 98986 98984 98982 Columns 511 through 525 98980 98978 98976 98974 98972 98970 98968 98966 98964 98962 98960 98958 98956 98954 98952 Columns 526 through 540 98950 98948 98946 98944 98942 98940 98938 98936 98934 98932 98930 98928 98926 98924 98922 Columns 541 through 555 98920 98918 98916 98914 98912 98910 98908 98906 98904 98902 98900 98898 98896 98894 98892 Columns 556 through 570 98890 98888 98886 98884 98882 98880 98878 98876 98874 98872 98870 98868 98866 98864 98862 Columns 571 through 585 98860 98858 98856 98854 98852 98850 98848 98846 98844 98842 98840 98838 98836 98834 98832 Columns 586 through 600 98830 98828 98826 98824 98822 98820 98818 98816 98814 98812 98810 98808 98806 98804 98802 Columns 601 through 615 98800 98798 98796 98794 98792 98790 98788 98786 98784 98782 98780 98778 98776 98774 98772 Columns 616 through 630 98770 98768 98766 98764 98762 98760 98758 98756 98754 98752 98750 98748 98746 98744 98742 Columns 631 through 645 98740 98738 98736 98734 98732 98730 98728 98726 98724 98722 98720 98718 98716 98714 98712 Columns 646 through 660 98710 98708 98706 98704 98702 98700 98698 98696 98694 98692 98690 98688 98686 98684 98682 Columns 661 through 675 98680 98678 98676 98674 98672 98670 98668 98666 98664 98662 98660 98658 98656 98654 98652 Columns 676 through 690 98650 98648 98646 98644 98642 98640 98638 98636 98634 98632 98630 98628 98626 98624 98622 Columns 691 through 705 98620 98618 98616 98614 98612 98610 98608 98606 98604 98602 98600 98598 98596 98594 98592 Columns 706 through 720 98590 98588 98586 98584 98582 98580 98578 98576 98574 98572 98570 98568 98566 ...

6   Pass
n = 666; y_correct = 480; assert(isequal(odd_elimination(n),y_correct))

y = Columns 1 through 30 666 664 662 660 658 656 654 652 650 648 646 644 642 640 638 636 634 632 630 628 626 624 622 620 618 616 614 612 610 608 Columns 31 through 60 606 604 602 600 598 596 594 592 590 588 586 584 582 580 578 576 574 572 570 568 566 564 562 560 558 556 554 552 550 548 Columns 61 through 90 546 544 542 540 538 536 534 532 530 528 526 524 522 520 518 516 514 512 510 508 506 504 502 500 498 496 494 492 490 488 Columns 91 through 120 486 484 482 480 478 476 474 472 470 468 466 464 462 460 458 456 454 452 450 448 446 444 442 440 438 436 434 432 430 428 Columns 121 through 150 426 424 422 420 418 416 414 412 410 408 406 404 402 400 398 396 394 392 390 388 386 384 382 380 378 376 374 372 370 368 Columns 151 through 180 366 364 362 360 358 356 354 352 350 348 346 344 342 340 338 336 334 332 330 328 326 324 322 320 318 316 314 312 310 308 Columns 181 through 210 306 304 302 300 298 296 294 292 290 288 286 284 282 280 278 276 274 272 270 268 266 264 262 260 258 256 254 252 250 248 Columns 211 through 240 246 244 242 240 238 236 234 232 230 228 226 224 222 220 218 216 214 212 210 208 206 204 202 200 198 196 194 192 190 188 Columns 241 through 270 186 184 182 180 178 176 174 172 170 168 166 164 162 160 158 156 154 152 150 148 146 144 142 140 138 136 134 132 130 128 Columns 271 through 300 126 124 122 120 118 116 114 112 110 108 106 104 102 100 98 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68 Columns 301 through 330 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 Columns 331 through 333 6 4 2 y = Columns 1 through 30 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 Columns 31 through 60 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 Columns 61 through 90 244 248 252 256 260 264 268 272 276 280 284 288 292 296 300 304 308 312 316 320 324 328 332 336 340 344 348 352 356 360 Columns 91 through 120 364 368 372 376 380 384 388 392 396 400 404 408 412 416 420 424 428 432 436 440 444 448 452 456 460 464 468 472 476 480 Columns 121 through 150 484 488 492 496 500 504 508 512 516 520 524 528 532 536 540 544 548 552 556 560 564 568 572 576 580 584 588 592 596 600 Columns 151 through 166 604 608 612 616 620 624 628 632 636 640 644 648 652 656 660 664 y = Columns 1 through 30 664 656 648 640 632 624 616 608 600 592 584 576 568 560 552 544 536 528 520 512 504 496 488 480 472 464 456 448 440 432 Columns 31 through 60 424 416 408 400 392 384 376 368 360 352 344 336 328 320 312 304 296 288 280 272 264 256 248 240 232 224 216 208 200 192 Columns 61 through 83 184 176 168 160 152 144 136 128 120 112 104 96 88 80 72 64 56 48 40 32 24 16 8 y = Columns 1 through 30 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 256 272 288 304 320 336 352 368 384 400 416 432 448 464 480 Columns 31 through 41 496 512 528 544 560 576 592 608 624 640 656 y = 640 608 576 544 512 480 448 416 384 352 320 288 256 224 192 160 128 96 64 32 y = 32 96 160 224 288 352 416 480 544 608 y = 608 480 352 224 96 y = 224 480 y = 480