Cody

Problem 953. Pi Estimate 1

Solution 3016807

Submitted on 1 Oct 2020 by Vijay Anand Ramachandran
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
x = 10; y_correct = 3.041840000000000; assert(isequal(pi_est1(x),y_correct))

k = 0 k = 1 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 k = 8 k = 9 k = 10 estimate = 3.041840000000000

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

k = 0 k = 1 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 k = 8 k = 9 k = 10 k = 11 k = 12 k = 13 k = 14 k = 15 k = 16 k = 17 k = 18 k = 19 k = 20 k = 21 k = 22 k = 23 k = 24 k = 25 k = 26 k = 27 k = 28 k = 29 k = 30 k = 31 k = 32 k = 33 k = 34 k = 35 k = 36 k = 37 k = 38 k = 39 k = 40 k = 41 k = 42 k = 43 k = 44 k = 45 k = 46 k = 47 k = 48 k = 49 k = 50 k = 51 k = 52 k = 53 k = 54 k = 55 k = 56 k = 57 k = 58 k = 59 k = 60 k = 61 k = 62 k = 63 k = 64 k = 65 k = 66 k = 67 k = 68 k = 69 k = 70 k = 71 k = 72 k = 73 k = 74 k = 75 k = 76 k = 77 k = 78 k = 79 k = 80 k = 81 k = 82 k = 83 k = 84 k = 85 k = 86 k = 87 k = 88 k = 89 k = 90 k = 91 k = 92 k = 93 k = 94 k = 95 k = 96 k = 97 k = 98 k = 99 k = 100 k = 101 k = 102 k = 103 k = 104 k = 105 k = 106 k = 107 k = 108 k = 109 k = 110 k = 111 k = 112 k = 113 k = 114 k = 115 k = 116 k = 117 k = 118 k = 119 k = 120 k = 121 k = 122 k = 123 k = 124 k = 125 k = 126 k = 127 k = 128 k = 129 k = 130 k = 131 k = 132 k = 133 k = 134 k = 135 k = 136 k = 137 k = 138 k = 139 k = 140 k = 141 k = 142 k = 143 k = 144 k = 145 k = 146 k = 147 k = 148 k = 149 k = 150 k = 151 k = 152 k = 153 k = 154 k = 155 k = 156 k = 157 k = 158 k = 159 k = 160 k = 161 k = 162 k = 163 k = 164 k = 165 k = 166 k = 167 k = 168 k = 169 k = 170 k = 171 k = 172 k = 173 k = 174 k = 175 k = 176 k = 177 k = 178 k = 179 k = 180 k = 181 k = 182 k = 183 k = 184 k = 185 k = 186 k = 187 k = 188 k = 189 k = 190 k = 191 k = 192 k = 193 k = 194 k = 195 k = 196 k = 197 k = 198 k = 199 k = 200 k = 201 k = 202 k = 203 k = 204 k = 205 k = 206 k = 207 k = 208 k = 209 k = 210 k = 211 k = 212 k = 213 k = 214 k = 215 k = 216 k = 217 k = 218 k = 219 k = 220 k = 221 k = 222 k = 223 k = 224 k = 225 k = 226 k = 227 k = 228 k = 229 k = 230 k = 231 k = 232 k = 233 k = 234 k = 235 k = 236 k = 237 k = 238 k = 239 k = 240 k = 241 k = 242 k = 243 k = 244 k = 245 k = 246 k = 247 k = 248 k = 249 k = 250 k = 251 k = 252 k = 253 k = 254 k = 255 k = 256 k = 257 k = 258 k = 259 k = 260 k = 261 k = 262 k = 263 k = 264 k = 265 k = 266 k = 267 k = 268 k = 269 k = 270 k = 271 k = 272 k = 273 k = 274 k = 275 k = 276 k = 277 k = 278 k = 279 k = 280 k = 281 k = 282 k = 283 k = 284 k = 285 k = 286 k = 287 k = 288 k = 289 k = 290 k = 291 k = 292 k = 293 k = 294 k = 295 k = 296 k = 297 k = 298 k = 299 k = 300 k = 301 k = 302 k = 303 k = 304 k = 305 k = 306 k = 307 k = 308 k = 309 k = 310 k = 311 k = 312 k = 313 k = 314 k = 315 k = 316 k = 317 k = 318 k = 319 k = 320 k = 321 k = 322 k = 323 k = 324 k = 325 k = 326 k = 327 k = 328 k = 329 k = 330 k = 331 k = 332 k = 333 k = 334 k = 335 k = 336 k = 337 k = 338 k = 339 k = 340 k = 341 k = 342 k = 343 k = 344 k = 345 k = 346 k = 347 k = 348 k = 349 k = 350 k = 351 k = 352 k = 353 k = 354 k = 355 k = 356 k = 357 k = 358 k = 359 k = 360 k = 361 k = 362 k = 363 k = 364 k = 365 k = 366 k = 367 k = 368 k = 369 k = 370 k = 371 k = 372 k = 373 k = 374 k = 375 k = 376 k = 377 k = 378 k = 379 k = 380 k = 381 k = 382 k = 383 k = 384 k = 385 k = 386 k = 387 k = 388 k = 389 k = 390 k = 391 k = 392 k = 393 k = 394 k = 395 k = 396 k = 397 k = 398 k = 399 k = 400 k = 401 k = 402 k = 403 k = 404 k = 405 k = 406 k = 407 k = 408 k = 409 k = 410 k = 411 k = 412 k = 413 k = 414 k = 415 k = 416 k = 417 k = 418 k = 419 k = 420 k = 421 k = 422 k = 423 k = 424 k = 425 k = 426 k = 427 k = 428 k = 429 k = 430 k = 431 k = 432 k = 433 k = 434 k = 435 k = 436 k = 437 k = 438 k = 439 k = 440 k = 441 k = 442 k = 443 k = 444 k = 445 k = 446 k = 447 k = 448 k = 449 k = 450 k = 451 k = 452 k = 453 k = 454 k = 455 k = 456 k = 457 k = 458 k = 459 k = 460 k = 461 k = 462 k = 463 k = 464 k = 465 k = 466 k = 467 k = 468 k = 469 k = 470 k = 471 k = 472 k = 473 k = 474 k = 475 k = 476 k = 477 k = 478 k = 479 k = 480 k = 481 k = 482 k = 483 k = 484 k = 485 k = 486 k = 487 k = 488 k = 489 k = 490 k = 491 k = 492 k = 493 k = 494 k = 495 k = 496 k = 497 k = 498 k = 499 k = 500 k = 501 k = 502 k = 503 k = 504 k = 505 k = 506 k = 507 k = 508 k = 509 k = 510 k = 511 k = 512 k = 513 k = 514 k = 515 k = 516 k = 517 k = 518 k = 519 k = 520 k = 521 k = 522 k = 523 k = 524 k = 525 k = 526 k = 527 k = 528 k = 529 k = 530 k = 531 k = 532 k = 533 k = 534 k = 535 k = 536 k = 537 k = 538 k = 539 k = 540 k = 541 k = 542 k = 543 k = 544 k = 545 k = 546 k = 547 k = 548 k = 549 k = 550 k = 551 k = 552 k = 553 k = 554 k = 555 k = 556 k = 557 k = 558 k = 559 k = 560 k = 561 k = 562 k = 563 k = 564 k = 565 k = 566 k = 567 k = 568 k = 569 k = 570 k = 571 k = 572 k = 573 k = 574 k = 575 k = 576 k = 577 k = 578 k = 579 k = 580 k = 581 k = 582 k = 583 k = 584 k = 585 k = 586 k = 587 k = 588 k = 589 k = 590 k = 591 k = 592 k = 593 k = 594 k = 595 k = 596 k = 597 k = 598 k = 599 k = 600 k = 601 k = 602 k = 603 k = 604 k = 605 k = 606 k = 607 k = 608 k = 609 k = 610 k = 611 k = 612 k = 613 k = 614 k = 615 k = 616 k = 617 k = 618 k = 619 k = 620 k = 621 k = 622 k = 623 k = 624 k = 625 k = 626 k = 627 k = 628 k = 629 k = 630 k = 631 k = 632 k = 633 k = 634 k = 635 k = 636 k = 637 k = 638 k = 639 k = 640 k = 641 k = 642 k = 643 k = 644 k = 645 k = 646 k = 647 k = 648 k = 649 k = 650 k = 651 k = 652 k = 653 k = 654 k = 655 k = 656 k = 657 k = 658 k = 659 k = 660 k = 661 k = 662 k = 663 k = 664 k = 665 k = 666 k = 667 k = 668 k = 669 k = 670 k = 671 k = 672 k = 673 k = 674 k = 675 k = 676 k = 677 k = 678 k = 679 k = 680 k = 681 k = 682 k = 683 k = 684 k = 685 k = 686 k = 687 k = 688 k = 689 k = 690 k = 691 k = 692 k = 693 k = 694 k = 695 k = 696 k = 697 k = 698 k = 699 k = 700 k = 701 k = 702 k = 703 k = 704 k = 705 k = 706 k = 707 k = 708 k = 709 k = 710 k = 711 k = 712 k = 713 k = ...

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

k = 0 k = 1 k = 2 k = 3 k = 4 k = 5 k = 6 k = 7 k = 8 k = 9 k = 10 k = 11 k = 12 k = 13 k = 14 k = 15 k = 16 k = 17 k = 18 k = 19 k = 20 k = 21 k = 22 k = 23 k = 24 k = 25 k = 26 k = 27 k = 28 k = 29 k = 30 k = 31 k = 32 k = 33 k = 34 k = 35 k = 36 k = 37 k = 38 k = 39 k = 40 k = 41 k = 42 k = 43 k = 44 k = 45 k = 46 k = 47 k = 48 k = 49 k = 50 k = 51 k = 52 k = 53 k = 54 k = 55 k = 56 k = 57 k = 58 k = 59 k = 60 k = 61 k = 62 k = 63 k = 64 k = 65 k = 66 k = 67 k = 68 k = 69 k = 70 k = 71 k = 72 k = 73 k = 74 k = 75 k = 76 k = 77 k = 78 k = 79 k = 80 k = 81 k = 82 k = 83 k = 84 k = 85 k = 86 k = 87 k = 88 k = 89 k = 90 k = 91 k = 92 k = 93 k = 94 k = 95 k = 96 k = 97 k = 98 k = 99 k = 100 k = 101 k = 102 k = 103 k = 104 k = 105 k = 106 k = 107 k = 108 k = 109 k = 110 k = 111 k = 112 k = 113 k = 114 k = 115 k = 116 k = 117 k = 118 k = 119 k = 120 k = 121 k = 122 k = 123 k = 124 k = 125 k = 126 k = 127 k = 128 k = 129 k = 130 k = 131 k = 132 k = 133 k = 134 k = 135 k = 136 k = 137 k = 138 k = 139 k = 140 k = 141 k = 142 k = 143 k = 144 k = 145 k = 146 k = 147 k = 148 k = 149 k = 150 k = 151 k = 152 k = 153 k = 154 k = 155 k = 156 k = 157 k = 158 k = 159 k = 160 k = 161 k = 162 k = 163 k = 164 k = 165 k = 166 k = 167 k = 168 k = 169 k = 170 k = 171 k = 172 k = 173 k = 174 k = 175 k = 176 k = 177 k = 178 k = 179 k = 180 k = 181 k = 182 k = 183 k = 184 k = 185 k = 186 k = 187 k = 188 k = 189 k = 190 k = 191 k = 192 k = 193 k = 194 k = 195 k = 196 k = 197 k = 198 k = 199 k = 200 k = 201 k = 202 k = 203 k = 204 k = 205 k = 206 k = 207 k = 208 k = 209 k = 210 k = 211 k = 212 k = 213 k = 214 k = 215 k = 216 k = 217 k = 218 k = 219 k = 220 k = 221 k = 222 k = 223 k = 224 k = 225 k = 226 k = 227 k = 228 k = 229 k = 230 k = 231 k = 232 k = 233 k = 234 k = 235 k = 236 k = 237 k = 238 k = 239 k = 240 k = 241 k = 242 k = 243 k = 244 k = 245 k = 246 k = 247 k = 248 k = 249 k = 250 k = 251 k = 252 k = 253 k = 254 k = 255 k = 256 k = 257 k = 258 k = 259 k = 260 k = 261 k = 262 k = 263 k = 264 k = 265 k = 266 k = 267 k = 268 k = 269 k = 270 k = 271 k = 272 k = 273 k = 274 k = 275 k = 276 k = 277 k = 278 k = 279 k = 280 k = 281 k = 282 k = 283 k = 284 k = 285 k = 286 k = 287 k = 288 k = 289 k = 290 k = 291 k = 292 k = 293 k = 294 k = 295 k = 296 k = 297 k = 298 k = 299 k = 300 k = 301 k = 302 k = 303 k = 304 k = 305 k = 306 k = 307 k = 308 k = 309 k = 310 k = 311 k = 312 k = 313 k = 314 k = 315 k = 316 k = 317 k = 318 k = 319 k = 320 k = 321 k = 322 k = 323 k = 324 k = 325 k = 326 k = 327 k = 328 k = 329 k = 330 k = 331 k = 332 k = 333 k = 334 k = 335 k = 336 k = 337 k = 338 k = 339 k = 340 k = 341 k = 342 k = 343 k = 344 k = 345 k = 346 k = 347 k = 348 k = 349 k = 350 k = 351 k = 352 k = 353 k = 354 k = 355 k = 356 k = 357 k = 358 k = 359 k = 360 k = 361 k = 362 k = 363 k = 364 k = 365 k = 366 k = 367 k = 368 k = 369 k = 370 k = 371 k = 372 k = 373 k = 374 k = 375 k = 376 k = 377 k = 378 k = 379 k = 380 k = 381 k = 382 k = 383 k = 384 k = 385 k = 386 k = 387 k = 388 k = 389 k = 390 k = 391 k = 392 k = 393 k = 394 k = 395 k = 396 k = 397 k = 398 k = 399 k = 400 k = 401 k = 402 k = 403 k = 404 k = 405 k = 406 k = 407 k = 408 k = 409 k = 410 k = 411 k = 412 k = 413 k = 414 k = 415 k = 416 k = 417 k = 418 k = 419 k = 420 k = 421 k = 422 k = 423 k = 424 k = 425 k = 426 k = 427 k = 428 k = 429 k = 430 k = 431 k = 432 k = 433 k = 434 k = 435 k = 436 k = 437 k = 438 k = 439 k = 440 k = 441 k = 442 k = 443 k = 444 k = 445 k = 446 k = 447 k = 448 k = 449 k = 450 k = 451 k = 452 k = 453 k = 454 k = 455 k = 456 k = 457 k = 458 k = 459 k = 460 k = 461 k = 462 k = 463 k = 464 k = 465 k = 466 k = 467 k = 468 k = 469 k = 470 k = 471 k = 472 k = 473 k = 474 k = 475 k = 476 k = 477 k = 478 k = 479 k = 480 k = 481 k = 482 k = 483 k = 484 k = 485 k = 486 k = 487 k = 488 k = 489 k = 490 k = 491 k = 492 k = 493 k = 494 k = 495 k = 496 k = 497 k = 498 k = 499 k = 500 k = 501 k = 502 k = 503 k = 504 k = 505 k = 506 k = 507 k = 508 k = 509 k = 510 k = 511 k = 512 k = 513 k = 514 k = 515 k = 516 k = 517 k = 518 k = 519 k = 520 k = 521 k = 522 k = 523 k = 524 k = 525 k = 526 k = 527 k = 528 k = 529 k = 530 k = 531 k = 532 k = 533 k = 534 k = 535 k = 536 k = 537 k = 538 k = 539 k = 540 k = 541 k = 542 k = 543 k = 544 k = 545 k = 546 k = 547 k = 548 k = 549 k = 550 k = 551 k = 552 k = 553 k = 554 k = 555 k = 556 k = 557 k = 558 k = 559 k = 560 k = 561 k = 562 k = 563 k = 564 k = 565 k = 566 k = 567 k = 568 k = 569 k = 570 k = 571 k = 572 k = 573 k = 574 k = 575 k = 576 k = 577 k = 578 k = 579 k = 580 k = 581 k = 582 k = 583 k = 584 k = 585 k = 586 k = 587 k = 588 k = 589 k = 590 k = 591 k = 592 k = 593 k = 594 k = 595 k = 596 k = 597 k = 598 k = 599 k = 600 k = 601 k = 602 k = 603 k = 604 k = 605 k = 606 k = 607 k = 608 k = 609 k = 610 k = 611 k = 612 k = 613 k = 614 k = 615 k = 616 k = 617 k = 618 k = 619 k = 620 k = 621 k = 622 k = 623 k = 624 k = 625 k = 626 k = 627 k = 628 k = 629 k = 630 k = 631 k = 632 k = 633 k = 634 k = 635 k = 636 k = 637 k = 638 k = 639 k = 640 k = 641 k = 642 k = 643 k = 644 k = 645 k = 646 k = 647 k = 648 k = 649 k = 650 k = 651 k = 652 k = 653 k = 654 k = 655 k = 656 k = 657 k = 658 k = 659 k = 660 k = 661 k = 662 k = 663 k = 664 k = 665 k = 666 k = 667 k = 668 k = 669 k = 670 k = 671 k = 672 k = 673 k = 674 k = 675 k = 676 k = 677 k = 678 k = 679 k = 680 k = 681 k = 682 k = 683 k = 684 k = 685 k = 686 k = 687 k = 688 k = 689 k = 690 k = 691 k = 692 k = 693 k = 694 k = 695 k = 696 k = 697 k = 698 k = 699 k = 700 k = 701 k = 702 k = 703 k = 704 k = 705 k = 706 k = 707 k = 708 k = 709 k = 710 k = 711 k = 712 k = 713 k = ...

Suggested Problems

More from this Author4

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!