Cody

Solution 2045162

Submitted on 4 Dec 2019 by Asif Newaz
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; out = 4; assert(isequal(next_square(n),out));

m = 1 y = 0 a = 1.4142 a = 1.7321 a = 2 y = 4

2   Pass
n = [5 7 9]; out = [9 9 16]; assert(isequal(next_square(n),out));

m = 3 y = 0 0 0 a = 2.4495 a = 2.6458 a = 2.8284 a = 3 y = 9 0 0 a = 2.8284 a = 3 y = 9 9 0 a = 3.1623 a = 3.3166 a = 3.4641 a = 3.6056 a = 3.7417 a = 3.8730 a = 4 y = 9 9 16

3   Pass
n = 10.^(1:5); out = [16 121 1024 10201 100489]; assert(isequal(next_square(n),out));

m = 5 y = 0 0 0 0 0 a = 3.3166 a = 3.4641 a = 3.6056 a = 3.7417 a = 3.8730 a = 4 y = 16 0 0 0 0 a = 10.0499 a = 10.0995 a = 10.1489 a = 10.1980 a = 10.2470 a = 10.2956 a = 10.3441 a = 10.3923 a = 10.4403 a = 10.4881 a = 10.5357 a = 10.5830 a = 10.6301 a = 10.6771 a = 10.7238 a = 10.7703 a = 10.8167 a = 10.8628 a = 10.9087 a = 10.9545 a = 11 y = 16 121 0 0 0 a = 31.6386 a = 31.6544 a = 31.6702 a = 31.6860 a = 31.7017 a = 31.7175 a = 31.7333 a = 31.7490 a = 31.7648 a = 31.7805 a = 31.7962 a = 31.8119 a = 31.8277 a = 31.8434 a = 31.8591 a = 31.8748 a = 31.8904 a = 31.9061 a = 31.9218 a = 31.9374 a = 31.9531 a = 31.9687 a = 31.9844 a = 32 y = 16 121 1024 0 0 a = 100.0050 a = 100.0100 a = 100.0150 a = 100.0200 a = 100.0250 a = 100.0300 a = 100.0350 a = 100.0400 a = 100.0450 a = 100.0500 a = 100.0550 a = 100.0600 a = 100.0650 a = 100.0700 a = 100.0750 a = 100.0800 a = 100.0850 a = 100.0900 a = 100.0950 a = 100.1000 a = 100.1049 a = 100.1099 a = 100.1149 a = 100.1199 a = 100.1249 a = 100.1299 a = 100.1349 a = 100.1399 a = 100.1449 a = 100.1499 a = 100.1549 a = 100.1599 a = 100.1649 a = 100.1699 a = 100.1748 a = 100.1798 a = 100.1848 a = 100.1898 a = 100.1948 a = 100.1998 a = 100.2048 a = 100.2098 a = 100.2148 a = 100.2198 a = 100.2247 a = 100.2297 a = 100.2347 a = 100.2397 a = 100.2447 a = 100.2497 a = 100.2547 a = 100.2597 a = 100.2646 a = 100.2696 a = 100.2746 a = 100.2796 a = 100.2846 a = 100.2896 a = 100.2946 a = 100.2996 a = 100.3045 a = 100.3095 a = 100.3145 a = 100.3195 a = 100.3245 a = 100.3295 a = 100.3344 a = 100.3394 a = 100.3444 a = 100.3494 a = 100.3544 a = 100.3594 a = 100.3643 a = 100.3693 a = 100.3743 a = 100.3793 a = 100.3843 a = 100.3892 a = 100.3942 a = 100.3992 a = 100.4042 a = 100.4092 a = 100.4141 a = 100.4191 a = 100.4241 a = 100.4291 a = 100.4341 a = 100.4390 a = 100.4440 a = 100.4490 a = 100.4540 a = 100.4589 a = 100.4639 a = 100.4689 a = 100.4739 a = 100.4789 a = 100.4838 a = 100.4888 a = 100.4938 a = 100.4988 a = 100.5037 a = 100.5087 a = 100.5137 a = 100.5187 a = 100.5236 a = 100.5286 a = 100.5336 a = 100.5385 a = 100.5435 a = 100.5485 a = 100.5535 a = 100.5584 a = 100.5634 a = 100.5684 a = 100.5734 a = 100.5783 a = 100.5833 a = 100.5883 a = 100.5932 a = 100.5982 a = 100.6032 a = 100.6082 a = 100.6131 a = 100.6181 a = 100.6231 a = 100.6280 a = 100.6330 a = 100.6380 a = 100.6429 a = 100.6479 a = 100.6529 a = 100.6578 a = 100.6628 a = 100.6678 a = 100.6727 a = 100.6777 a = 100.6827 a = 100.6876 a = 100.6926 a = 100.6976 a = 100.7025 a = 100.7075 a = 100.7125 a = 100.7174 a = 100.7224 a = 100.7274 a = 100.7323 a = 100.7373 a = 100.7422 a = 100.7472 a = 100.7522 a = 100.7571 a = 100.7621 a = 100.7671 a = 100.7720 a = 100.7770 a = 100.7819 a = 100.7869 a = 100.7919 a = 100.7968 a = 100.8018 a = 100.8067 a = 100.8117 a = 100.8167 a = 100.8216 a = 100.8266 a = 100.8315 a = 100.8365 a = 100.8415 a = 100.8464 a = 100.8514 a = 100.8563 a = 100.8613 a = 100.8662 a = 100.8712 a = 100.8762 a = 100.8811 a = 100.8861 a = 100.8910 a = 100.8960 a = 100.9009 a = 100.9059 a = 100.9109 a = 100.9158 a = 100.9208 a = 100.9257 a = 100.9307 a = 100.9356 a = 100.9406 a = 100.9455 a = 100.9505 a = 100.9554 a = 100.9604 a = 100.9653 a = 100.9703 a = 100.9752 a = 100.9802 a = 100.9851 a = 100.9901 a = 100.9950 a = 101 y = 16 121 1024 10201 0 a = 316.2293 a = 316.2309 a = 316.2325 a = 316.2341 a = 316.2357 a = 316.2373 a = 316.2388 a = 316.2404 a = 316.2420 a = 316.2436 a = 316.2452 a = 316.2467 a = 316.2483 a = 316.2499 a = 316.2515 a = 316.2531 a = 316.2546 a = 316.2562 a = 316.2578 a = 316.2594 a = 316.2610 a = 316.2625 a = 316.2641 a = 316.2657 a = 316.2673 a = 316.2689 a = 316.2705 a = 316.2720 a = 316.2736 a = 316.2752 a = 316.2768 a = 316.2784 a = 316.2799 a = 316.2815 a = 316.2831 a = 316.2847 a = 316.2863 a = 316.2878 a = 316.2894 a = 316.2910 a = 316.2926 a = 316.2942 a = 316.2957 a = 316.2973 a = 316.2989 a = 316.3005 a = 316.3021 a = 316.3037 a = 316.3052 a = 316.3068 a = 316.3084 a = 316.3100 a = 316.3116 a = 316.3131 a = 316.3147 a = 316.3163 a = 316.3179 a = 316.3195 a = 316.3210 a = 316.3226 a = 316.3242 a = 316.3258 a = 316.3274 a = 316.3289 a = 316.3305 a = 316.3321 a = 316.3337 a = 316.3353 a = 316.3368 a = 316.3384 a = 316.3400 a = 316.3416 a = 316.3432 a = 316.3447 a = 316.3463 a = 316.3479 a = 316.3495 a = 316.3511 a = 316.3527 a = 316.3542 a = 316.3558 a = 316.3574 a = 316.3590 a = 316.3606 a = 316.3621 a = 316.3637 a = 316.3653 a = 316.3669 a = 316.3685 a = 316.3700 a = 316.3716 a = 316.3732 a = 316.3748 a = 316.3764 a = 316.3779 a = 316.3795 a = 316.3811 a = 316.3827 a = 316.3843 a = 316.3858 a = 316.3874 a = 316.3890 a = 316.3906 a = 316.3922 a = 316.3937 a = 316.3953 a = 316.3969 a = 316.3985 a = 316.4001 a = 316.4016 a = 316.4032 a = 316.4048 a = 316.4064 a = 316.4080 a = 316.4095 a = 316.4111 a = 316.4127 a = 316.4143 a = 316.4159 a = 316.4174 a = 316.4190 a = 316.4206 a = 316.4222 a = 316.4238 a = 316.4253 a = 316.4269 a = 316.4285 a = 316.4301 a = 316.4317 a = 316.4332 a = 316.4348 a = 316.4364 a = 316.4380 a = 316.4396 a = 316.4411 a = 316.4427 a = 316.4443 a = 316.4459 a = 316.4475 a = 316.4490 a = 316.4506 a = 316.4522 a = 316.4538 a = 316.4554 a = 316.4569 a = 316.4585 a = 316.4601 a = 316.4617 a = 316.4633 a = 316.4648 a = 316.4664 a = 316.4680 a = 316.4696 a = 316.4712 a = 316.4727 a = 316.4743 a = 316.4759 a = 316.4775 a = 316.4791 a = 316.4806 a = 316.4822 a = 316.4838 a = 316.4854 a = 316.4870 a = 316.4885 a = 316.4901 a = 316.4917 a = 316.4933 a = 316.4949 a = 316.4964 a = 316.4980 a = 316.4996 a = 316.5012 a = 316.5028 a = 316.5043 a = 316.5059 a = 316.5075 a = 316.5091 a = 316.5107 a = 316.5122 a = 316.5138 a = 316.5154 a = 316.5170 a = 316.5186 a = 316.5201 a = 316.5217 a = 316.5233 a = 316.5249 a = 316.5265 a = 316.5280 a = 316.5296 a = 316.5312 a = 316.5328 a = 316.5344 a = 316.5359 a = 316.5375 a = 316.5391 a = 316.5407 a = 316.5423 a = 316.5438 a = 316.5454 a = 316.5470 a = 316.5486 a = 316.5502 a = 316.5517 a = 316.5533 a = 316.5549 a = 316.5565 a = 316.5581 a = 316.5596 a = 316.5612 a = 316.5628 a = 316.5644 a = 316.5659 a = 316.5675 a = 316.5691 a = 316.5707 a = 316.5723 a = 316.5738 a = 316.5754 a = 316.5770 a = 316.5786 a = 316.5802 a = 316.5817 a = 316.5833 a = 316.5849 a = 316.5865 a = 316.5881 a = 316.5896 a = 316.5912 a = 316.5928 a = 316.5944 a = 316.5960 a = 316.5975 a = 316.5991 a = 316.6007 a = 316.6023 a = 316.6039 a = 316.6054 a = 316.6070 a = 316.6086 a = 316.6102 a = 316.6117 a = 316.6133 a = 316.6149 a = 316.6165 a = 316.6181 a = 316.6196 a = 316.6212 a = 316.6228 a = 316.6244 a = 316.6260 a = 316.6275 a = 316.6291 a = 316.6307 a = 316.6323 a = 316.6339 a = 316.6354 a = 316.6370 a = 316.6386 a = 316.6402 a = 316.6418 a = 316.6433 a = 316.6449 a = 316.6465 a = 316.6481 a = 316.6496 a = 316.6512 a = 316.6528 a = 316.6544 a = 316.6560 a = 316.6575 a = 316.6591 a = 316.6607 a = 316.6623 a = 316.6639 a = 316.6654 a = 316.6670 a = 316.6686 a = 316.6702 a = 316.6718 a = 316.6733 a = 316.6749 a = 316.6765 a = 316.6781 a = 316.6796 a = 316.6812 a = 316.6828 a = 316.6844 a = 316.686...

4   Pass
n = round(7.^(3:.5:8)); out = [361 961 2500 6400 16900 44521 118336 311364 824464 2181529 5769604]; assert(isequal(next_square(n),out));

m = 11 y = 0 0 0 0 0 0 0 0 0 0 0 a = 18.5472 a = 18.5742 a = 18.6011 a = 18.6279 a = 18.6548 a = 18.6815 a = 18.7083 a = 18.7350 a = 18.7617 a = 18.7883 a = 18.8149 a = 18.8414 a = 18.8680 a = 18.8944 a = 18.9209 a = 18.9473 a = 18.9737 a = 19 y = 361 0 0 0 0 0 0 0 0 0 0 a = 30.1330 a = 30.1496 a = 30.1662 a = 30.1828 a = 30.1993 a = 30.2159 a = 30.2324 a = 30.2490 a = 30.2655 a = 30.2820 a = 30.2985 a = 30.3150 a = 30.3315 a = 30.3480 a = 30.3645 a = 30.3809 a = 30.3974 a = 30.4138 a = 30.4302 a = 30.4467 a = 30.4631 a = 30.4795 a = 30.4959 a = 30.5123 a = 30.5287 a = 30.5450 a = 30.5614 a = 30.5778 a = 30.5941 a = 30.6105 a = 30.6268 a = 30.6431 a = 30.6594 a = 30.6757 a = 30.6920 a = 30.7083 a = 30.7246 a = 30.7409 a = 30.7571 a = 30.7734 a = 30.7896 a = 30.8058 a = 30.8221 a = 30.8383 a = 30.8545 a = 30.8707 a = 30.8869 a = 30.9031 a = 30.9192 a = 30.9354 a = 30.9516 a = 30.9677 a = 30.9839 a = 31 y = 361 961 0 0 0 0 0 0 0 0 0 a = 49.0102 a = 49.0204 a = 49.0306 a = 49.0408 a = 49.0510 a = 49.0612 a = 49.0714 a = 49.0816 a = 49.0918 a = 49.1019 a = 49.1121 a = 49.1223 a = 49.1325 a = 49.1426 a = 49.1528 a = 49.1630 a = 49.1732 a = 49.1833 a = 49.1935 a = 49.2037 a = 49.2138 a = 49.2240 a = 49.2341 a = 49.2443 a = 49.2544 a = 49.2646 a = 49.2747 a = 49.2849 a = 49.2950 a = 49.3052 a = 49.3153 a = 49.3254 a = 49.3356 a = 49.3457 a = 49.3559 a = 49.3660 a = 49.3761 a = 49.3862 a = 49.3964 a = 49.4065 a = 49.4166 a = 49.4267 a = 49.4368 a = 49.4469 a = 49.4571 a = 49.4672 a = 49.4773 a = 49.4874 a = 49.4975 a = 49.5076 a = 49.5177 a = 49.5278 a = 49.5379 a = 49.5480 a = 49.5580 a = 49.5681 a = 49.5782 a = 49.5883 a = 49.5984 a = 49.6085 a = 49.6185 a = 49.6286 a = 49.6387 a = 49.6488 a = 49.6588 a = 49.6689 a = 49.6790 a = 49.6890 a = 49.6991 a = 49.7092 a = 49.7192 a = 49.7293 a = 49.7393 a = 49.7494 a = 49.7594 a = 49.7695 a = 49.7795 a = 49.7896 a = 49.7996 a = 49.8096 a = 49.8197 a = 49.8297 a = 49.8397 a = 49.8498 a = 49.8598 a = 49.8698 a = 49.8799 a = 49.8899 a = 49.8999 a = 49.9099 a = 49.9199 a = 49.9300 a = 49.9400 a = 49.9500 a = 49.9600 a = 49.9700 a = 49.9800 a = 49.9900 a = 50 y = 361 961 2500 0 0 0 0 0 0 0 0 a = 79.7057 a = 79.7120 a = 79.7183 a = 79.7245 a = 79.7308 a = 79.7371 a = 79.7433 a = 79.7496 a = 79.7559 a = 79.7621 a = 79.7684 a = 79.7747 a = 79.7810 a = 79.7872 a = 79.7935 a = 79.7997 a = 79.8060 a = 79.8123 a = 79.8185 a = 79.8248 a = 79.8311 a = 79.8373 a = 79.8436 a = 79.8499 a = 79.8561 a = 79.8624 a = 79.8686 a = 79.8749 a = 79.8812 a = 79.8874 a = 79.8937 a = 79.8999 a = 79.9062 a = 79.9125 a = 79.9187 a = 79.9250 a = 79.9312 a = 79.9375 a = 79.9437 a = 79.9500 a = 79.9562 a = 79.9625 a = 79.9687 a = 79.9750 a = 79.9812 a = 79.9875 a = 79.9937 a = 80 y = 361 961 2500 6400 0 0 0 0 0 0 0 a = 129.6457 a = 129.6495 a = 129.6534 a = 129.6572 a = 129.6611 a = 129.6650 a = 129.6688 a = 129.6727 a = 129.6765 a = 129.6804 a = 129.6842 a = 129.6881 a = 129.6919 a = 129.6958 a = 129.6997 a = 129.7035 a = 129.7074 a = 129.7112 a = 129.7151 a = 129.7189 a = 129.7228 a = 129.7266 a = 129.7305 a = 129.7343 a = 129.7382 a = 129.7421 a = 129.7459 a = 129.7498 a = 129.7536 a = 129.7575 a = 129.7613 a = 129.7652 a = 129.7690 a = 129.7729 a = 129.7767 a = 129.7806 a = 129.7844 a = 129.7883 a = 129.7921 a = 129.7960 a = 129.7998 a = 129.8037 a = 129.8075 a = 129.8114 a = 129.8153 a = 129.8191 a = 129.8230 a = 129.8268 a = 129.8307 a = 129.8345 a = 129.8384 a = 129.8422 a = 129.8461 a = 129.8499 a = 129.8538 a = 129.8576 a = 129.8615 a = 129.8653 a = 129.8692 a = 129.8730 a = 129.8769 a = 129.8807 a = 129.8846 a = 129.8884 a = 129.8923 a = 129.8961 a = 129.9000 a = 129.9038 a = 129.9077 a = 129.9115 a = 129.9154 a = 129.9192 a = 129.9231 a = 129.9269 a = 129.9308 a = 129.9346 a = 129.9384 a = 129.9423 a = 129.9461 a = 129.9500 a = 129.9538 a = 129.9577 a = 129.9615 a = 129.9654 a = 129.9692 a = 129.9731 a = 129.9769 a = 129.9808 a = 129.9846 a = 129.9885 a = 129.9923 a = 129.9962 a = 130 y = 361 961 2500 6400 16900 0 0 0 0 0 0 a = 210.8744 a = 210.8767 a = 210.8791 a = 210.8815 a = 210.8839 a = 210.8862 a = 210.8886 a = 210.8910 a = 210.8933 a = 210.8957 a = 210.8981 a = 210.9005 a = 210.9028 a = 210.9052 a = 210.9076 a = 210.9099 a = 210.9123 a = 210.9147 a = 210.9170 a = 210.9194 a = 210.9218 a = 210.9242 a = 210.9265 a = 210.9289 a = 210.9313 a = 210.9336 a = 210.9360 a = 210.9384 a = 210.9407 a = 210.9431 a = 210.9455 a = 210.9479 a = 210.9502 a = 210.9526 a = 210.9550 a = 210.9573 a = 210.9597 a = 210.9621 a = 210.9645 a = 210.9668 a = 210.9692 a = 210.9716 a = 210.9739 a = 210.9763 a = 210.9787 a = 210.9810 a = 210.9834 a = 210.9858 a = 210.9882 a = 210.9905 a = 210.9929 a = 210.9953 a = 210.9976 a = 211 y = 361 961 2500 6400 16900 44521 0 0 0 0 0 a = 343.0015 a = 343.0029 a = 343.0044 a = 343.0058 a = 343.0073 a = 343.0087 a = 343.0102 a = 343.0117 a = 343.0131 a = 343.0146 a = 343.0160 a = 343.0175 a = 343.0189 a = 343.0204 a = 343.0219 a = 343.0233 a = 343.0248 a = 343.0262 a = 343.0277 a = 343.0292 a = 343.0306 a = 343.0321 a = 343.0335 a = 343.0350 a = 343.0364 a = 343.0379 a = 343.0394 a = 343.0408 a = 343.0423 a = 343.0437 a = 343.0452 a = 343.0466 a = 343.0481 a = 343.0496 a = 343.0510 a = 343.0525 a = 343.0539 a = 343.0554 a = 343.0568 a = 343.0583 a = 343.0598 a = 343.0612 a = 343.0627 a = 343.0641 a = 343.0656 a = 343.0670 a = 343.0685 a = 343.0700 a = 343.0714 a = 343.0729 a = 343.0743 a = 343.0758 a = 343.0773 a = 343.0787 a = 343.0802 a = 343.0816 a = 343.0831 a = 343.0845 a = 343.0860 a = 343.0875 a = 343.0889 a = 343.0904 a = 343.0918 a = 343.0933 a = 343.0947 a = 343.0962 a = 343.0977 a = 343.0991 a = 343.1006 a = 343.1020 a = 343.1035 a = 343.1049 a = 343.1064 a = 343.1079 a = 343.1093 a = 343.1108 a = 343.1122 a = 343.1137 a = 343.1151 a = 343.1166 a = 343.1181 a = 343.1195 a = 343.1210 a = 343.1224 a = 343.1239 a = 343.1253 a = 343.1268 a = 343.1283 a = 343.1297 a = 343.1312 a = 343.1326 a = 343.1341 a = 343.1355 a = 343.1370 a = 343.1385 a = 343.1399 a = 343.1414 a = 343.1428 a = 343.1443 a = 343.1457 a = 343.1472 a = 343.1487 a = 343.1501 a = 343.1516 a = 343.1530 a = 343.1545 a = 343.1559 a = 343.1574 a = 343.1589 a = 343.1603 a = 343.1618 a = 343.1632 a = 343.1647 a = 343.1661 a = 343.1676 a = 343.1691 a = 343.1705 a = 343.1720 a = 343.1734 a = 343.1749 a = 343.1763 a = 343.1778 a = 343.1793 a = 343.1807 a = 343.1822 a = 343.1836 a = 343.1851 a = 343.1865 a = 343.1880 a = 343.1895 a = 343.1909 a = 343.1924 a = 343.1938 a = 343.1953 a = 343.1967 a = 343.1982 a = 343.1997 a = 343.2011 a = 343.2026 a = 343.2040 a = 343.2055 a = 343.2069 a = 343.2084 a = 343.2098 a = 343.2113 a = 343.2128 a = 343.2...

Suggested Problems

More from this Author2