Cody

Solution 1954365

Submitted on 1 Oct 2019 by Khanh Le Quang
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 = 3; y_correct = 15; assert(isequal(magic_sum(n),y_correct))

sum = 8 sum = 9 sum = 15 m = 15

2   Pass
n = 5; y_correct = 65; assert(isequal(magic_sum(n),y_correct))

sum = 17 sum = 41 sum = 42 sum = 50 sum = 65 m = 65

3   Pass
n = 7; y_correct = 175; assert(isequal(magic_sum(n),y_correct))

sum = 30 sum = 69 sum = 117 sum = 118 sum = 128 sum = 147 sum = 175 m = 175

4   Pass
n = 8; y_correct = 260; assert(isequal(magic_sum(n),y_correct))

sum = 64 sum = 66 sum = 69 sum = 130 sum = 190 sum = 196 sum = 203 sum = 260 m = 260

5   Pass
n = 20; y_correct = 4010; assert(isequal(magic_sum(n),y_correct))

sum = 400 sum = 402 sum = 405 sum = 802 sum = 1198 sum = 1204 sum = 1211 sum = 1604 sum = 1996 sum = 2006 sum = 2017 sum = 2406 sum = 2794 sum = 2808 sum = 2823 sum = 3208 sum = 3592 sum = 3610 sum = 3629 sum = 4010 m = 4010

6   Pass
n = 100; y_correct = 500050; assert(isequal(magic_sum(n),y_correct))

sum = 10000 sum = 10002 sum = 10005 sum = 20002 sum = 29998 sum = 30004 sum = 30011 sum = 40004 sum = 49996 sum = 50006 sum = 50017 sum = 60006 sum = 69994 sum = 70008 sum = 70023 sum = 80008 sum = 89992 sum = 90010 sum = 90029 sum = 100010 sum = 109990 sum = 110012 sum = 110035 sum = 120012 sum = 129988 sum = 130014 sum = 130041 sum = 140014 sum = 149986 sum = 150016 sum = 150047 sum = 160016 sum = 169984 sum = 170018 sum = 170053 sum = 180018 sum = 189982 sum = 190020 sum = 190059 sum = 200020 sum = 209980 sum = 210022 sum = 210065 sum = 220022 sum = 229978 sum = 230024 sum = 230071 sum = 240024 sum = 249976 sum = 250026 sum = 250077 sum = 260026 sum = 269974 sum = 270028 sum = 270083 sum = 280028 sum = 289972 sum = 290030 sum = 290089 sum = 300030 sum = 309970 sum = 310032 sum = 310095 sum = 320032 sum = 329968 sum = 330034 sum = 330101 sum = 340034 sum = 349966 sum = 350036 sum = 350107 sum = 360036 sum = 369964 sum = 370038 sum = 370113 sum = 380038 sum = 389962 sum = 390040 sum = 390119 sum = 400040 sum = 409960 sum = 410042 sum = 410125 sum = 420042 sum = 429958 sum = 430044 sum = 430131 sum = 440044 sum = 449956 sum = 450046 sum = 450137 sum = 460046 sum = 469954 sum = 470048 sum = 470143 sum = 480048 sum = 489952 sum = 490050 sum = 490149 sum = 500050 m = 500050

7   Pass
n = 200; y_correct = 4000100; assert(isequal(magic_sum(n),y_correct))

sum = 40000 sum = 40002 sum = 40005 sum = 80002 sum = 119998 sum = 120004 sum = 120011 sum = 160004 sum = 199996 sum = 200006 sum = 200017 sum = 240006 sum = 279994 sum = 280008 sum = 280023 sum = 320008 sum = 359992 sum = 360010 sum = 360029 sum = 400010 sum = 439990 sum = 440012 sum = 440035 sum = 480012 sum = 519988 sum = 520014 sum = 520041 sum = 560014 sum = 599986 sum = 600016 sum = 600047 sum = 640016 sum = 679984 sum = 680018 sum = 680053 sum = 720018 sum = 759982 sum = 760020 sum = 760059 sum = 800020 sum = 839980 sum = 840022 sum = 840065 sum = 880022 sum = 919978 sum = 920024 sum = 920071 sum = 960024 sum = 999976 sum = 1000026 sum = 1000077 sum = 1040026 sum = 1079974 sum = 1080028 sum = 1080083 sum = 1120028 sum = 1159972 sum = 1160030 sum = 1160089 sum = 1200030 sum = 1239970 sum = 1240032 sum = 1240095 sum = 1280032 sum = 1319968 sum = 1320034 sum = 1320101 sum = 1360034 sum = 1399966 sum = 1400036 sum = 1400107 sum = 1440036 sum = 1479964 sum = 1480038 sum = 1480113 sum = 1520038 sum = 1559962 sum = 1560040 sum = 1560119 sum = 1600040 sum = 1639960 sum = 1640042 sum = 1640125 sum = 1680042 sum = 1719958 sum = 1720044 sum = 1720131 sum = 1760044 sum = 1799956 sum = 1800046 sum = 1800137 sum = 1840046 sum = 1879954 sum = 1880048 sum = 1880143 sum = 1920048 sum = 1959952 sum = 1960050 sum = 1960149 sum = 2000050 sum = 2039950 sum = 2040052 sum = 2040155 sum = 2080052 sum = 2119948 sum = 2120054 sum = 2120161 sum = 2160054 sum = 2199946 sum = 2200056 sum = 2200167 sum = 2240056 sum = 2279944 sum = 2280058 sum = 2280173 sum = 2320058 sum = 2359942 sum = 2360060 sum = 2360179 sum = 2400060 sum = 2439940 sum = 2440062 sum = 2440185 sum = 2480062 sum = 2519938 sum = 2520064 sum = 2520191 sum = 2560064 sum = 2599936 sum = 2600066 sum = 2600197 sum = 2640066 sum = 2679934 sum = 2680068 sum = 2680203 sum = 2720068 sum = 2759932 sum = 2760070 sum = 2760209 sum = 2800070 sum = 2839930 sum = 2840072 sum = 2840215 sum = 2880072 sum = 2919928 sum = 2920074 sum = 2920221 sum = 2960074 sum = 2999926 sum = 3000076 sum = 3000227 sum = 3040076 sum = 3079924 sum = 3080078 sum = 3080233 sum = 3120078 sum = 3159922 sum = 3160080 sum = 3160239 sum = 3200080 sum = 3239920 sum = 3240082 sum = 3240245 sum = 3280082 sum = 3319918 sum = 3320084 sum = 3320251 sum = 3360084 sum = 3399916 sum = 3400086 sum = 3400257 sum = 3440086 sum = 3479914 sum = 3480088 sum = 3480263 sum = 3520088 sum = 3559912 sum = 3560090 sum = 3560269 sum = 3600090 sum = 3639910 sum = 3640092 sum = 3640275 sum = 3680092 sum = 3719908 sum = 3720094 sum = 3720281 sum = 3760094 sum = 3799906 sum = 3800096 sum = 3800287 sum = 3840096 sum = 3879904 sum = 3880098 sum = 3880293 sum = 3920098 sum = 3959902 sum = 3960100 sum = 3960299 sum = 4000100 m = 4000100

8   Pass
n = 1000; y_correct = 500000500; assert(isequal(magic_sum(n),y_correct))

sum = 1000000 sum = 1000002 sum = 1000005 sum = 2000002 sum = 2999998 sum = 3000004 sum = 3000011 sum = 4000004 sum = 4999996 sum = 5000006 sum = 5000017 sum = 6000006 sum = 6999994 sum = 7000008 sum = 7000023 sum = 8000008 sum = 8999992 sum = 9000010 sum = 9000029 sum = 10000010 sum = 10999990 sum = 11000012 sum = 11000035 sum = 12000012 sum = 12999988 sum = 13000014 sum = 13000041 sum = 14000014 sum = 14999986 sum = 15000016 sum = 15000047 sum = 16000016 sum = 16999984 sum = 17000018 sum = 17000053 sum = 18000018 sum = 18999982 sum = 19000020 sum = 19000059 sum = 20000020 sum = 20999980 sum = 21000022 sum = 21000065 sum = 22000022 sum = 22999978 sum = 23000024 sum = 23000071 sum = 24000024 sum = 24999976 sum = 25000026 sum = 25000077 sum = 26000026 sum = 26999974 sum = 27000028 sum = 27000083 sum = 28000028 sum = 28999972 sum = 29000030 sum = 29000089 sum = 30000030 sum = 30999970 sum = 31000032 sum = 31000095 sum = 32000032 sum = 32999968 sum = 33000034 sum = 33000101 sum = 34000034 sum = 34999966 sum = 35000036 sum = 35000107 sum = 36000036 sum = 36999964 sum = 37000038 sum = 37000113 sum = 38000038 sum = 38999962 sum = 39000040 sum = 39000119 sum = 40000040 sum = 40999960 sum = 41000042 sum = 41000125 sum = 42000042 sum = 42999958 sum = 43000044 sum = 43000131 sum = 44000044 sum = 44999956 sum = 45000046 sum = 45000137 sum = 46000046 sum = 46999954 sum = 47000048 sum = 47000143 sum = 48000048 sum = 48999952 sum = 49000050 sum = 49000149 sum = 50000050 sum = 50999950 sum = 51000052 sum = 51000155 sum = 52000052 sum = 52999948 sum = 53000054 sum = 53000161 sum = 54000054 sum = 54999946 sum = 55000056 sum = 55000167 sum = 56000056 sum = 56999944 sum = 57000058 sum = 57000173 sum = 58000058 sum = 58999942 sum = 59000060 sum = 59000179 sum = 60000060 sum = 60999940 sum = 61000062 sum = 61000185 sum = 62000062 sum = 62999938 sum = 63000064 sum = 63000191 sum = 64000064 sum = 64999936 sum = 65000066 sum = 65000197 sum = 66000066 sum = 66999934 sum = 67000068 sum = 67000203 sum = 68000068 sum = 68999932 sum = 69000070 sum = 69000209 sum = 70000070 sum = 70999930 sum = 71000072 sum = 71000215 sum = 72000072 sum = 72999928 sum = 73000074 sum = 73000221 sum = 74000074 sum = 74999926 sum = 75000076 sum = 75000227 sum = 76000076 sum = 76999924 sum = 77000078 sum = 77000233 sum = 78000078 sum = 78999922 sum = 79000080 sum = 79000239 sum = 80000080 sum = 80999920 sum = 81000082 sum = 81000245 sum = 82000082 sum = 82999918 sum = 83000084 sum = 83000251 sum = 84000084 sum = 84999916 sum = 85000086 sum = 85000257 sum = 86000086 sum = 86999914 sum = 87000088 sum = 87000263 sum = 88000088 sum = 88999912 sum = 89000090 sum = 89000269 sum = 90000090 sum = 90999910 sum = 91000092 sum = 91000275 sum = 92000092 sum = 92999908 sum = 93000094 sum = 93000281 sum = 94000094 sum = 94999906 sum = 95000096 sum = 95000287 sum = 96000096 sum = 96999904 sum = 97000098 sum = 97000293 sum = 98000098 sum = 98999902 sum = 99000100 sum = 99000299 sum = 100000100 sum = 100999900 sum = 101000102 sum = 101000305 sum = 102000102 sum = 102999898 sum = 103000104 sum = 103000311 sum = 104000104 sum = 104999896 sum = 105000106 sum = 105000317 sum = 106000106 sum = 106999894 sum = 107000108 sum = 107000323 sum = 108000108 sum = 108999892 sum = 109000110 sum = 109000329 sum = 110000110 sum = 110999890 sum = 111000112 sum = 111000335 sum = 112000112 sum = 112999888 sum = 113000114 sum = 113000341 sum = 114000114 sum = 114999886 sum = 115000116 sum = 115000347 sum = 116000116 sum = 116999884 sum = 117000118 sum = 117000353 sum = 118000118 sum = 118999882 sum = 119000120 sum = 119000359 sum = 120000120 sum = 120999880 sum = 121000122 sum = 121000365 sum = 122000122 sum = 122999878 sum = 123000124 sum = 123000371 sum = 124000124 sum = 124999876 sum = 125000126 sum = 125000377 sum = 126000126 sum = 126999874 sum = 127000128 sum = 127000383 sum = 128000128 sum = 128999872 sum = 129000130 sum = 129000389 sum = 130000130 sum = 130999870 sum = 131000132 sum = 131000395 sum = 132000132 sum = 132999868 sum = 133000134 sum = 133000401 sum = 134000134 sum = 134999866 sum = 135000136 sum = 135000407 sum = 136000136 sum = 136999864 sum = 137000138 sum = 137000413 sum = 138000138 sum = 138999862 sum = 139000140 sum = 139000419 sum = 140000140 sum = 140999860 sum = 141000142 sum = 141000425 sum = 142000142 sum = 142999858 sum = 143000144 sum = 143000431 sum = 144000144 sum = 144999856 sum = 145000146 sum = 145000437 sum = 146000146 sum = 146999854 sum = 147000148 sum = 147000443 sum = 148000148 sum = 148999852 sum = 149000150 sum = 149000449 sum = 150000150 sum = 150999850 sum = 151000152 sum = 151000455 sum = 152000152 sum = 152999848 sum = 153000154 sum = 153000461 sum = 154000154 sum = 154999846 sum = 155000156 sum = 155000467 sum = 156000156 sum = 156999844 sum = 157000158 sum = 157000473 sum = 158000158 sum = 158999842 sum = 159000160 sum = 159000479 sum = 160000160 sum = 160999840 sum = 161000162 sum = 161000485 sum = 162000162 sum = 162999838 sum = 163000164 sum = 163000491 sum = 164000164 sum = 164999836 sum = 165000166 sum = 165000497 sum = 166000166 sum = 166999834 sum = 167000168 sum = 167000503 sum = 168000168 sum = 168999832 sum = 169000170 sum = 169000509 sum = 170000170 sum = 170999830 sum = 171000172 sum = 171000515 sum = 172000172 sum = 172999828 sum = 173000174 sum = 173000521 sum = 174000174 sum = 174999826 sum = 175000176 sum = 175000527 sum = 176000176 sum = 176999824 sum = 177000178 sum = 177000533 sum = 178000178 sum = 178999822 sum = 179000180 sum = 179000539 sum = 180000180 sum = 180999820 sum = 181000182 sum = 181000545 sum = 182000182 sum = 182999818 sum = 183000184 sum = 183000551 sum = 184000184 sum = 184999816 sum = 185000186 sum = 185000557 sum = 186000186 sum = 186999814 sum = 187000188 sum = 187000563 sum = 188000188 sum = 188999812 sum = 189000190 sum = 189000569 sum = 190000190 sum = 190999810 sum = 191000192 sum = 191000575 sum = 192000192 sum = 192999808 sum = 193000194 sum = 193000581 sum = 194000194 sum = 194999806 sum = 195000196 sum = 195000587 sum = 196000196 sum = 196999804 sum = 197000198 sum = 197000593 sum = 198000198 sum = 198999802 sum = 199000200 sum = 199000599 sum = 200000200 sum = 200999800 sum = 201000202 sum = 201000605 sum = 202000202 sum = 202999798 sum = 203000204 sum = 203000611 sum = 204000204 sum = 204999796 sum = 205000206 sum = 205000617 sum = 206000206 sum = 206999794 sum = 207000208 sum = 207000623 sum = 208000208 sum = 208999792 sum = 209000210 sum = 209000629 sum = 210000210 sum = 210999790 sum = 211000212 sum = 211000635 sum = 212000212 sum = 212999788 sum = 213000214 sum = 213000641 sum = 214000214 sum = 214999786 sum = 215000216 sum = 215000647 sum = 216000216 sum = 216999784 sum = 217000218 sum = 217000653 sum = 218000218 sum = 218999782 sum = 219000220 sum = 219000659 sum = 220000220 sum = 220999780 sum = 221000222 sum = 221000665 sum = 222000222 sum = 222999778 sum = 223000224 sum = 223000671 sum = 224000224 sum = 224999776 sum = 225000226 sum = 225000677 sum = 226000226 sum = 226999774 sum = 227000228 sum = 22...