Cody

# Problem 953. Pi Estimate 1

Solution 2579409

Submitted on 18 Jun 2020
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   Fail
x = 10; y_correct = 3.041840000000000; assert(isequal(pi_est1(x),y_correct))

n = 1 3 5 7 9 11 13 15 17 19 ans = -40

Assertion failed.

2   Fail
x = 1000; y_correct = 3.140593000000000; assert(isequal(pi_est1(x),y_correct))

n = Columns 1 through 15 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 Columns 16 through 30 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 Columns 31 through 45 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 Columns 46 through 60 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 Columns 61 through 75 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 Columns 76 through 90 151 153 155 157 159 161 163 165 167 169 171 173 175 177 179 Columns 91 through 105 181 183 185 187 189 191 193 195 197 199 201 203 205 207 209 Columns 106 through 120 211 213 215 217 219 221 223 225 227 229 231 233 235 237 239 Columns 121 through 135 241 243 245 247 249 251 253 255 257 259 261 263 265 267 269 Columns 136 through 150 271 273 275 277 279 281 283 285 287 289 291 293 295 297 299 Columns 151 through 165 301 303 305 307 309 311 313 315 317 319 321 323 325 327 329 Columns 166 through 180 331 333 335 337 339 341 343 345 347 349 351 353 355 357 359 Columns 181 through 195 361 363 365 367 369 371 373 375 377 379 381 383 385 387 389 Columns 196 through 210 391 393 395 397 399 401 403 405 407 409 411 413 415 417 419 Columns 211 through 225 421 423 425 427 429 431 433 435 437 439 441 443 445 447 449 Columns 226 through 240 451 453 455 457 459 461 463 465 467 469 471 473 475 477 479 Columns 241 through 255 481 483 485 487 489 491 493 495 497 499 501 503 505 507 509 Columns 256 through 270 511 513 515 517 519 521 523 525 527 529 531 533 535 537 539 Columns 271 through 285 541 543 545 547 549 551 553 555 557 559 561 563 565 567 569 Columns 286 through 300 571 573 575 577 579 581 583 585 587 589 591 593 595 597 599 Columns 301 through 315 601 603 605 607 609 611 613 615 617 619 621 623 625 627 629 Columns 316 through 330 631 633 635 637 639 641 643 645 647 649 651 653 655 657 659 Columns 331 through 345 661 663 665 667 669 671 673 675 677 679 681 683 685 687 689 Columns 346 through 360 691 693 695 697 699 701 703 705 707 709 711 713 715 717 719 Columns 361 through 375 721 723 725 727 729 731 733 735 737 739 741 743 745 747 749 Columns 376 through 390 751 753 755 757 759 761 763 765 767 769 771 773 775 777 779 Columns 391 through 405 781 783 785 787 789 791 793 795 797 799 801 803 805 807 809 Columns 406 through 420 811 813 815 817 819 821 823 825 827 829 831 833 835 837 839 Columns 421 through 435 841 843 845 847 849 851 853 855 857 859 861 863 865 867 869 Columns 436 through 450 871 873 875 877 879 881 883 885 887 889 891 893 895 897 899 Columns 451 through 465 901 903 905 907 909 911 913 915 917 919 921 923 925 927 929 Columns 466 through 480 931 933 935 937 939 941 943 945 947 949 951 953 955 957 959 Columns 481 through 495 961 963 965 967 969 971 973 975 977 979 981 983 985 987 989 Columns 496 through 510 991 993 995 997 999 1001 1003 1005 1007 1009 1011 1013 1015 1017 1019 Columns 511 through 525 1021 1023 1025 1027 1029 1031 1033 1035 1037 1039 1041 1043 1045 1047 1049 Columns 526 through 540 1051 1053 1055 1057 1059 1061 1063 1065 1067 1069 1071 1073 1075 1077 1079 Columns 541 through 555 1081 1083 1085 1087 1089 1091 1093 1095 1097 1099 1101 1103 1105 1107 1109 Columns 556 through 570 1111 1113 1115 1117 1119 1121 1123 1125 1127 1129 1131 1133 1135 1137 1139 Columns 571 through 585 1141 1143 1145 1147 1149 1151 1153 1155 1157 1159 1161 1163 1165 1167 1169 Columns 586 through 600 1171 1173 1175 1177 1179 1181 1183 1185 1187 1189 1191 1193 1195 1197 1199 Columns 601 through 615 1201 1203 1205 1207 1209 1211 1213 1215 1217 1219 1221 1223 1225 1227 1229 Columns 616 through 630 1231 1233 1235 1237 1239 1241 1243 1245 1247 1249 1251 1253 1255 1257 1259 Columns 631 through 645 1261 1263 1265 1267 1269 1271 1273 1275 1277 1279 1281 1283 1285 1287 1289 Columns 646 through 660 1291 1293 1295 1297 1299 1301 1303 1305 1307 1309 1311 1313 1315 1317 1319 Columns 661 through 675 1321 1323 1325 1327 1329 1331 1333 1335 1337 1339 1341 1343 1345 1347 1349 Columns 676 through 690 1351 1353 1355 1357 1359 1361 1363 1365 1367 1369 1371 1373 1375 1377 1379 Columns 691 through 705 1381 1383 1385 1387 1389 1391 1393 1395 1397 1399 1401 1403 1405 1407 1409 Columns 706 through 720 1411 1413 1415 1417 1419 1421 1423 1425 1427 1429 1431 1433 1435 ...

Assertion failed.

3   Fail
x = 1e6; y_correct = 3.141592000000000; assert(isequal(pi_est1(x),y_correct))

n = Columns 1 through 15 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 Columns 16 through 30 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 Columns 31 through 45 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 Columns 46 through 60 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 Columns 61 through 75 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 Columns 76 through 90 151 153 155 157 159 161 163 165 167 169 171 173 175 177 179 Columns 91 through 105 181 183 185 187 189 191 193 195 197 199 201 203 205 207 209 Columns 106 through 120 211 213 215 217 219 221 223 225 227 229 231 233 235 237 239 Columns 121 through 135 241 243 245 247 249 251 253 255 257 259 261 263 265 267 269 Columns 136 through 150 271 273 275 277 279 281 283 285 287 289 291 293 295 297 299 Columns 151 through 165 301 303 305 307 309 311 313 315 317 319 321 323 325 327 329 Columns 166 through 180 331 333 335 337 339 341 343 345 347 349 351 353 355 357 359 Columns 181 through 195 361 363 365 367 369 371 373 375 377 379 381 383 385 387 389 Columns 196 through 210 391 393 395 397 399 401 403 405 407 409 411 413 415 417 419 Columns 211 through 225 421 423 425 427 429 431 433 435 437 439 441 443 445 447 449 Columns 226 through 240 451 453 455 457 459 461 463 465 467 469 471 473 475 477 479 Columns 241 through 255 481 483 485 487 489 491 493 495 497 499 501 503 505 507 509 Columns 256 through 270 511 513 515 517 519 521 523 525 527 529 531 533 535 537 539 Columns 271 through 285 541 543 545 547 549 551 553 555 557 559 561 563 565 567 569 Columns 286 through 300 571 573 575 577 579 581 583 585 587 589 591 593 595 597 599 Columns 301 through 315 601 603 605 607 609 611 613 615 617 619 621 623 625 627 629 Columns 316 through 330 631 633 635 637 639 641 643 645 647 649 651 653 655 657 659 Columns 331 through 345 661 663 665 667 669 671 673 675 677 679 681 683 685 687 689 Columns 346 through 360 691 693 695 697 699 701 703 705 707 709 711 713 715 717 719 Columns 361 through 375 721 723 725 727 729 731 733 735 737 739 741 743 745 747 749 Columns 376 through 390 751 753 755 757 759 761 763 765 767 769 771 773 775 777 779 Columns 391 through 405 781 783 785 787 789 791 793 795 797 799 801 803 805 807 809 Columns 406 through 420 811 813 815 817 819 821 823 825 827 829 831 833 835 837 839 Columns 421 through 435 841 843 845 847 849 851 853 855 857 859 861 863 865 867 869 Columns 436 through 450 871 873 875 877 879 881 883 885 887 889 891 893 895 897 899 Columns 451 through 465 901 903 905 907 909 911 913 915 917 919 921 923 925 927 929 Columns 466 through 480 931 933 935 937 939 941 943 945 947 949 951 953 955 957 959 Columns 481 through 495 961 963 965 967 969 971 973 975 977 979 981 983 985 987 989 Columns 496 through 510 991 993 995 997 999 1001 1003 1005 1007 1009 1011 1013 1015 1017 1019 Columns 511 through 525 1021 1023 1025 1027 1029 1031 1033 1035 1037 1039 1041 1043 1045 1047 1049 Columns 526 through 540 1051 1053 1055 1057 1059 1061 1063 1065 1067 1069 1071 1073 1075 1077 1079 Columns 541 through 555 1081 1083 1085 1087 1089 1091 1093 1095 1097 1099 1101 1103 1105 1107 1109 Columns 556 through 570 1111 1113 1115 1117 1119 1121 1123 1125 1127 1129 1131 1133 1135 1137 1139 Columns 571 through 585 1141 1143 1145 1147 1149 1151 1153 1155 1157 1159 1161 1163 1165 1167 1169 Columns 586 through 600 1171 1173 1175 1177 1179 1181 1183 1185 1187 1189 1191 1193 1195 1197 1199 Columns 601 through 615 1201 1203 1205 1207 1209 1211 1213 1215 1217 1219 1221 1223 1225 1227 1229 Columns 616 through 630 1231 1233 1235 1237 1239 1241 1243 1245 1247 1249 1251 1253 1255 1257 1259 Columns 631 through 645 1261 1263 1265 1267 1269 1271 1273 1275 1277 1279 1281 1283 1285 1287 1289 Columns 646 through 660 1291 1293 1295 1297 1299 1301 1303 1305 1307 1309 1311 1313 1315 1317 1319 Columns 661 through 675 1321 1323 1325 1327 1329 1331 1333 1335 1337 1339 1341 1343 1345 1347 1349 Columns 676 through 690 1351 1353 1355 1357 1359 1361 1363 1365 1367 1369 1371 1373 1375 1377 1379 Columns 691 through 705 1381 1383 1385 1387 1389 1391 1393 1395 1397 1399 1401 1403 1405 1407 1409 Columns 706 through 720 1411 1413 1415 1417 1419 1421 1423 1425 1427 1429 1431 1433 1435 ...

Assertion failed.