Cody

# Problem 953. Pi Estimate 1

Solution 2046698

Submitted on 5 Dec 2019 by Petr Procházka
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
x = 10; y_correct = 3.041840000000000; assert(isequal(pi_est1(x),y_correct))

a = 0 b = 1 a = 1 b = -0.3333 a = 0.6667 b = 0.2000 a = 0.8667 b = -0.1429 a = 0.7238 b = 0.1111 a = 0.8349 b = -0.0909 a = 0.7440 b = 0.0769 a = 0.8209 b = -0.0667 a = 0.7543 b = 0.0588 a = 0.8131 b = -0.0526 a = 0.7605 c = 3.0418 estimate = 3.0418

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

a = 0 b = 1 a = 1 b = -0.3333 a = 0.6667 b = 0.2000 a = 0.8667 b = -0.1429 a = 0.7238 b = 0.1111 a = 0.8349 b = -0.0909 a = 0.7440 b = 0.0769 a = 0.8209 b = -0.0667 a = 0.7543 b = 0.0588 a = 0.8131 b = -0.0526 a = 0.7605 b = 0.0476 a = 0.8081 b = -0.0435 a = 0.7646 b = 0.0400 a = 0.8046 b = -0.0370 a = 0.7676 b = 0.0345 a = 0.8020 b = -0.0323 a = 0.7698 b = 0.0303 a = 0.8001 b = -0.0286 a = 0.7715 b = 0.0270 a = 0.7985 b = -0.0256 a = 0.7729 b = 0.0244 a = 0.7973 b = -0.0233 a = 0.7740 b = 0.0222 a = 0.7963 b = -0.0213 a = 0.7750 b = 0.0204 a = 0.7954 b = -0.0196 a = 0.7758 b = 0.0189 a = 0.7947 b = -0.0182 a = 0.7765 b = 0.0175 a = 0.7940 b = -0.0169 a = 0.7771 b = 0.0164 a = 0.7935 b = -0.0159 a = 0.7776 b = 0.0154 a = 0.7930 b = -0.0149 a = 0.7780 b = 0.0145 a = 0.7925 b = -0.0141 a = 0.7785 b = 0.0137 a = 0.7922 b = -0.0133 a = 0.7788 b = 0.0130 a = 0.7918 b = -0.0127 a = 0.7791 b = 0.0123 a = 0.7915 b = -0.0120 a = 0.7794 b = 0.0118 a = 0.7912 b = -0.0115 a = 0.7797 b = 0.0112 a = 0.7910 b = -0.0110 a = 0.7800 b = 0.0108 a = 0.7907 b = -0.0105 a = 0.7802 b = 0.0103 a = 0.7905 b = -0.0101 a = 0.7804 b = 0.0099 a = 0.7903 b = -0.0097 a = 0.7806 b = 0.0095 a = 0.7901 b = -0.0093 a = 0.7808 b = 0.0092 a = 0.7899 b = -0.0090 a = 0.7809 b = 0.0088 a = 0.7898 b = -0.0087 a = 0.7811 b = 0.0085 a = 0.7896 b = -0.0084 a = 0.7812 b = 0.0083 a = 0.7895 b = -0.0081 a = 0.7814 b = 0.0080 a = 0.7894 b = -0.0079 a = 0.7815 b = 0.0078 a = 0.7892 b = -0.0076 a = 0.7816 b = 0.0075 a = 0.7891 b = -0.0074 a = 0.7817 b = 0.0073 a = 0.7890 b = -0.0072 a = 0.7818 b = 0.0071 a = 0.7889 b = -0.0070 a = 0.7819 b = 0.0069 a = 0.7888 b = -0.0068 a = 0.7820 b = 0.0067 a = 0.7887 b = -0.0066 a = 0.7821 b = 0.0065 a = 0.7886 b = -0.0065 a = 0.7822 b = 0.0064 a = 0.7886 b = -0.0063 a = 0.7823 b = 0.0062 a = 0.7885 b = -0.0061 a = 0.7823 b = 0.0061 a = 0.7884 b = -0.0060 a = 0.7824 b = 0.0059 a = 0.7883 b = -0.0058 a = 0.7825 b = 0.0058 a = 0.7883 b = -0.0057 a = 0.7826 b = 0.0056 a = 0.7882 b = -0.0056 a = 0.7826 b = 0.0055 a = 0.7881 b = -0.0055 a = 0.7827 b = 0.0054 a = 0.7881 b = -0.0053 a = 0.7827 b = 0.0053 a = 0.7880 b = -0.0052 a = 0.7828 b = 0.0052 a = 0.7880 b = -0.0051 a = 0.7828 b = 0.0051 a = 0.7879 b = -0.0050 a = 0.7829 b = 0.0050 a = 0.7879 b = -0.0049 a = 0.7829 b = 0.0049 a = 0.7878 b = -0.0048 a = 0.7830 b = 0.0048 a = 0.7878 b = -0.0047 a = 0.7830 b = 0.0047 a = 0.7877 b = -0.0047 a = 0.7831 b = 0.0046 a = 0.7877 b = -0.0046 a = 0.7831 b = 0.0045 a = 0.7877 b = -0.0045 a = 0.7832 b = 0.0044 a = 0.7876 b = -0.0044 a = 0.7832 b = 0.0044 a = 0.7876 b = -0.0043 a = 0.7832 b = 0.0043 a = 0.7875 b = -0.0043 a = 0.7833 b = 0.0042 a = 0.7875 b = -0.0042 a = 0.7833 b = 0.0041 a = 0.7875 b = -0.0041 a = 0.7833 b = 0.0041 a = 0.7874 b = -0.0040 a = 0.7834 b = 0.0040 a = 0.7874 b = -0.0040 a = 0.7834 b = 0.0040 a = 0.7874 b = -0.0039 a = 0.7834 b = 0.0039 a = 0.7873 b = -0.0039 a = 0.7835 b = 0.0038 a = 0.7873 b = -0.0038 a = 0.7835 b = 0.0038 a = 0.7873 b = -0.0037 a = 0.7835 b = 0.0037 a = 0.7872 b = -0.0037 a = 0.7836 b = 0.0037 a = 0.7872 b = -0.0036 a = 0.7836 b = 0.0036 a = 0.7872 b = -0.0036 a = 0.7836 b = 0.0036 a = 0.7872 b = -0.0035 a = 0.7836 b = 0.0035 a = 0.7871 b = -0.0035 a = 0.7837 b = 0.0035 a = 0.7871 b = -0.0034 a = 0.7837 b = 0.0034 a = 0.7871 b = -0.0034 a = 0.7837 b = 0.0034 a = 0.7871 b = -0.0033 a = 0.7837 b = 0.0033 a = 0.7871 b = -0.0033 a = 0.7838 b = 0.0033 a = 0.7870 b = -0.0033 a = 0.7838 b = 0.0032 a = 0.7870 b = -0.0032 a = 0.7838 b = 0.0032 a = 0.7870 b = -0.0032 a = 0.7838 b = 0.0032 a = 0.7870 b = -0.0031 a = 0.7838 b = 0.0031 a = 0.7870 b = -0.0031 a = 0.7839 b = 0.0031 a = 0.7869 b = -0.0031 a = 0.7839 b = 0.0030 a = 0.7869 b = -0.0030 a = 0.7839 b = 0.0030 a = 0.7869 b = -0.0030 a = 0.7839 b = 0.0030 a = 0.7869 b = -0.0029 a = 0.7839 b = 0.0029 a = 0.7869 b = -0.0029 a = 0.7839 b = 0.0029 a = 0.7868 b = -0.0029 a = 0.7840 b = 0.0029 a = 0.7868 b = -0.0028 a = 0.7840 b = 0.0028 a = 0.7868 b = -0.0028 a = 0.7840 b = 0.0028 a = 0.7868 b = -0.0028 a = 0.7840 b = 0.0028 a = 0.7868 b = -0.0028 a = 0.7840 b = 0.0027 a = 0.7868 b = -0.0027 a = 0.7840 b = 0.0027 a = 0.7867 b = -0.0027 a = 0.7841 b = 0.0027 a = 0.7867 b = -0.0027 a = 0.7841 b = 0.0027 a = 0.7867 b = -0.0026 a = 0.7841 b = 0.0026 a = 0.7867 b = -0.0026 a = 0.7841 b = 0.0026 a = 0.7867 b = -0.0026 a = 0.7841 b = 0.0026 a = 0.7867 b = -0.0026 a = 0.7841 b = 0.0025 a = 0.7867 b = -0.0025 a = 0.7841 b = 0.0025 a = 0.7867 b = -0.0025 a = 0.7841 b = 0.0025 a = 0.7866 b = -0.0025 a = 0.7842 b = 0.0025 a = 0.7866 b = -0.0025 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0024 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0024 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0024 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0024 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0023 a = 0.7842 b = 0.0023 a = 0.7866 b = -0.0023 a = 0.7842 b = 0.0023 a = 0.7866 b = -0.0023 a = 0.7843 b = 0.0023 a = 0.7865 b = -0.0023 a = 0.7843 b = 0.0023 a = 0.7865 b = -0.0023 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0021 a = 0.7843 b = 0.0021 a = 0.7865 b = -0.0021 a = 0.7843 b = 0.0021 a = 0.7865 b = -0.0021 a = 0.7843 b = 0.0021 a = 0.7864 b = -0.0021 a = 0.7844 b = 0.0021 a = 0.7864 b = -0.0021 a = 0.7844 b = 0.0021 a = 0.7864 b = -0.0021 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0019 a = 0.7864 b = -0.0019 a = 0.7844 b = 0.0019 a = 0.7864 b = -0.0019 a = 0.7844 b = 0.0019 a = 0.7864 b = -0.0019 a = 0.7844 b = 0.0019 a = 0.7863 b = -0.0019 a = 0.7845 b = 0.0019 a = 0.7863 b = -0.0019 a = 0.7845 b = 0.0019 a = 0.7863 b = -0.0019 a = 0.7845 b = 0.0019 a = 0.7863 b = -0.0019 a = 0.7845 b = 0.0018 a = 0.7863 b = -0.0018 a = 0.7845 b = 0.0018 a = 0.7863 b = -0.0018 a = 0.7845 b = 0.0018 a = 0.7863 b = -0.0018 a = 0.7845 b = 0.0018 a = 0.7863 b = -0.0018 a = ...

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

a = 0 b = 1 a = 1 b = -0.3333 a = 0.6667 b = 0.2000 a = 0.8667 b = -0.1429 a = 0.7238 b = 0.1111 a = 0.8349 b = -0.0909 a = 0.7440 b = 0.0769 a = 0.8209 b = -0.0667 a = 0.7543 b = 0.0588 a = 0.8131 b = -0.0526 a = 0.7605 b = 0.0476 a = 0.8081 b = -0.0435 a = 0.7646 b = 0.0400 a = 0.8046 b = -0.0370 a = 0.7676 b = 0.0345 a = 0.8020 b = -0.0323 a = 0.7698 b = 0.0303 a = 0.8001 b = -0.0286 a = 0.7715 b = 0.0270 a = 0.7985 b = -0.0256 a = 0.7729 b = 0.0244 a = 0.7973 b = -0.0233 a = 0.7740 b = 0.0222 a = 0.7963 b = -0.0213 a = 0.7750 b = 0.0204 a = 0.7954 b = -0.0196 a = 0.7758 b = 0.0189 a = 0.7947 b = -0.0182 a = 0.7765 b = 0.0175 a = 0.7940 b = -0.0169 a = 0.7771 b = 0.0164 a = 0.7935 b = -0.0159 a = 0.7776 b = 0.0154 a = 0.7930 b = -0.0149 a = 0.7780 b = 0.0145 a = 0.7925 b = -0.0141 a = 0.7785 b = 0.0137 a = 0.7922 b = -0.0133 a = 0.7788 b = 0.0130 a = 0.7918 b = -0.0127 a = 0.7791 b = 0.0123 a = 0.7915 b = -0.0120 a = 0.7794 b = 0.0118 a = 0.7912 b = -0.0115 a = 0.7797 b = 0.0112 a = 0.7910 b = -0.0110 a = 0.7800 b = 0.0108 a = 0.7907 b = -0.0105 a = 0.7802 b = 0.0103 a = 0.7905 b = -0.0101 a = 0.7804 b = 0.0099 a = 0.7903 b = -0.0097 a = 0.7806 b = 0.0095 a = 0.7901 b = -0.0093 a = 0.7808 b = 0.0092 a = 0.7899 b = -0.0090 a = 0.7809 b = 0.0088 a = 0.7898 b = -0.0087 a = 0.7811 b = 0.0085 a = 0.7896 b = -0.0084 a = 0.7812 b = 0.0083 a = 0.7895 b = -0.0081 a = 0.7814 b = 0.0080 a = 0.7894 b = -0.0079 a = 0.7815 b = 0.0078 a = 0.7892 b = -0.0076 a = 0.7816 b = 0.0075 a = 0.7891 b = -0.0074 a = 0.7817 b = 0.0073 a = 0.7890 b = -0.0072 a = 0.7818 b = 0.0071 a = 0.7889 b = -0.0070 a = 0.7819 b = 0.0069 a = 0.7888 b = -0.0068 a = 0.7820 b = 0.0067 a = 0.7887 b = -0.0066 a = 0.7821 b = 0.0065 a = 0.7886 b = -0.0065 a = 0.7822 b = 0.0064 a = 0.7886 b = -0.0063 a = 0.7823 b = 0.0062 a = 0.7885 b = -0.0061 a = 0.7823 b = 0.0061 a = 0.7884 b = -0.0060 a = 0.7824 b = 0.0059 a = 0.7883 b = -0.0058 a = 0.7825 b = 0.0058 a = 0.7883 b = -0.0057 a = 0.7826 b = 0.0056 a = 0.7882 b = -0.0056 a = 0.7826 b = 0.0055 a = 0.7881 b = -0.0055 a = 0.7827 b = 0.0054 a = 0.7881 b = -0.0053 a = 0.7827 b = 0.0053 a = 0.7880 b = -0.0052 a = 0.7828 b = 0.0052 a = 0.7880 b = -0.0051 a = 0.7828 b = 0.0051 a = 0.7879 b = -0.0050 a = 0.7829 b = 0.0050 a = 0.7879 b = -0.0049 a = 0.7829 b = 0.0049 a = 0.7878 b = -0.0048 a = 0.7830 b = 0.0048 a = 0.7878 b = -0.0047 a = 0.7830 b = 0.0047 a = 0.7877 b = -0.0047 a = 0.7831 b = 0.0046 a = 0.7877 b = -0.0046 a = 0.7831 b = 0.0045 a = 0.7877 b = -0.0045 a = 0.7832 b = 0.0044 a = 0.7876 b = -0.0044 a = 0.7832 b = 0.0044 a = 0.7876 b = -0.0043 a = 0.7832 b = 0.0043 a = 0.7875 b = -0.0043 a = 0.7833 b = 0.0042 a = 0.7875 b = -0.0042 a = 0.7833 b = 0.0041 a = 0.7875 b = -0.0041 a = 0.7833 b = 0.0041 a = 0.7874 b = -0.0040 a = 0.7834 b = 0.0040 a = 0.7874 b = -0.0040 a = 0.7834 b = 0.0040 a = 0.7874 b = -0.0039 a = 0.7834 b = 0.0039 a = 0.7873 b = -0.0039 a = 0.7835 b = 0.0038 a = 0.7873 b = -0.0038 a = 0.7835 b = 0.0038 a = 0.7873 b = -0.0037 a = 0.7835 b = 0.0037 a = 0.7872 b = -0.0037 a = 0.7836 b = 0.0037 a = 0.7872 b = -0.0036 a = 0.7836 b = 0.0036 a = 0.7872 b = -0.0036 a = 0.7836 b = 0.0036 a = 0.7872 b = -0.0035 a = 0.7836 b = 0.0035 a = 0.7871 b = -0.0035 a = 0.7837 b = 0.0035 a = 0.7871 b = -0.0034 a = 0.7837 b = 0.0034 a = 0.7871 b = -0.0034 a = 0.7837 b = 0.0034 a = 0.7871 b = -0.0033 a = 0.7837 b = 0.0033 a = 0.7871 b = -0.0033 a = 0.7838 b = 0.0033 a = 0.7870 b = -0.0033 a = 0.7838 b = 0.0032 a = 0.7870 b = -0.0032 a = 0.7838 b = 0.0032 a = 0.7870 b = -0.0032 a = 0.7838 b = 0.0032 a = 0.7870 b = -0.0031 a = 0.7838 b = 0.0031 a = 0.7870 b = -0.0031 a = 0.7839 b = 0.0031 a = 0.7869 b = -0.0031 a = 0.7839 b = 0.0030 a = 0.7869 b = -0.0030 a = 0.7839 b = 0.0030 a = 0.7869 b = -0.0030 a = 0.7839 b = 0.0030 a = 0.7869 b = -0.0029 a = 0.7839 b = 0.0029 a = 0.7869 b = -0.0029 a = 0.7839 b = 0.0029 a = 0.7868 b = -0.0029 a = 0.7840 b = 0.0029 a = 0.7868 b = -0.0028 a = 0.7840 b = 0.0028 a = 0.7868 b = -0.0028 a = 0.7840 b = 0.0028 a = 0.7868 b = -0.0028 a = 0.7840 b = 0.0028 a = 0.7868 b = -0.0028 a = 0.7840 b = 0.0027 a = 0.7868 b = -0.0027 a = 0.7840 b = 0.0027 a = 0.7867 b = -0.0027 a = 0.7841 b = 0.0027 a = 0.7867 b = -0.0027 a = 0.7841 b = 0.0027 a = 0.7867 b = -0.0026 a = 0.7841 b = 0.0026 a = 0.7867 b = -0.0026 a = 0.7841 b = 0.0026 a = 0.7867 b = -0.0026 a = 0.7841 b = 0.0026 a = 0.7867 b = -0.0026 a = 0.7841 b = 0.0025 a = 0.7867 b = -0.0025 a = 0.7841 b = 0.0025 a = 0.7867 b = -0.0025 a = 0.7841 b = 0.0025 a = 0.7866 b = -0.0025 a = 0.7842 b = 0.0025 a = 0.7866 b = -0.0025 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0024 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0024 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0024 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0024 a = 0.7842 b = 0.0024 a = 0.7866 b = -0.0023 a = 0.7842 b = 0.0023 a = 0.7866 b = -0.0023 a = 0.7842 b = 0.0023 a = 0.7866 b = -0.0023 a = 0.7843 b = 0.0023 a = 0.7865 b = -0.0023 a = 0.7843 b = 0.0023 a = 0.7865 b = -0.0023 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0022 a = 0.7843 b = 0.0022 a = 0.7865 b = -0.0021 a = 0.7843 b = 0.0021 a = 0.7865 b = -0.0021 a = 0.7843 b = 0.0021 a = 0.7865 b = -0.0021 a = 0.7843 b = 0.0021 a = 0.7864 b = -0.0021 a = 0.7844 b = 0.0021 a = 0.7864 b = -0.0021 a = 0.7844 b = 0.0021 a = 0.7864 b = -0.0021 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0020 a = 0.7864 b = -0.0020 a = 0.7844 b = 0.0019 a = 0.7864 b = -0.0019 a = 0.7844 b = 0.0019 a = 0.7864 b = -0.0019 a = 0.7844 b = 0.0019 a = 0.7864 b = -0.0019 a = 0.7844 b = 0.0019 a = 0.7863 b = -0.0019 a = 0.7845 b = 0.0019 a = 0.7863 b = -0.0019 a = 0.7845 b = 0.0019 a = 0.7863 b = -0.0019 a = 0.7845 b = 0.0019 a = 0.7863 b = -0.0019 a = 0.7845 b = 0.0018 a = 0.7863 b = -0.0018 a = 0.7845 b = 0.0018 a = 0.7863 b = -0.0018 a = 0.7845 b = 0.0018 a = 0.7863 b = -0.0018 a = 0.7845 b = 0.0018 a = 0.7863 b = -0.0018 a = ...