Cody

Problem 83. Prime factor digits

Solution 2888105

Submitted on 28 Aug 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   Pass
n = 2; p_correct = 1; assert(isequal(factor_digits(n),p_correct))

b = 2 m = 1 p = 1

2   Fail
n = 26; p_correct = [1 0 0 0 0 1]; assert(isequal(factor_digits(n),p_correct))

b = 23 m = 1.1304 p = 1.1304 b = 19 m = 1.3684 p = 1.1304 1.3684 b = 17 m = 1.5294 p = 1.1304 1.3684 1.5294 b = 13 m = 2 p = 1.1304 1.3684 1.5294 2.0000 b = 11 m = 0.1818 p = 1.1304 1.3684 1.5294 2.0000 0.1818 b = 7 m = 0.2857 p = 1.1304 1.3684 1.5294 2.0000 0.1818 0.2857 b = 5 m = 0.4000 p = 1.1304 1.3684 1.5294 2.0000 0.1818 0.2857 0.4000 b = 3 m = 0.6667 p = 1.1304 1.3684 1.5294 2.0000 0.1818 0.2857 0.4000 0.6667 b = 2 m = 1 p = 1.1304 1.3684 1.5294 2.0000 0.1818 0.2857 0.4000 0.6667 1.0000

Assertion failed.

3   Fail
n = 168; p_correct = [1 0 1 3]; assert(isequal(factor_digits(n),p_correct))

b = 167 m = 1.0060 p = 1.0060 b = 163 m = 1.0307 p = 1.0060 1.0307 b = 157 m = 1.0701 p = 1.0060 1.0307 1.0701 b = 151 m = 1.1126 p = 1.0060 1.0307 1.0701 1.1126 b = 149 m = 1.1275 p = 1.0060 1.0307 1.0701 1.1126 1.1275 b = 139 m = 1.2086 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 b = 137 m = 1.2263 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 b = 131 m = 1.2824 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 b = 127 m = 1.3228 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 b = 113 m = 1.4867 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 b = 109 m = 1.5413 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 b = 107 m = 1.5701 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 b = 103 m = 1.6311 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 b = 101 m = 1.6634 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 b = 97 m = 1.7320 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 b = 89 m = 1.8876 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 b = 83 m = 2.0241 p = 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 b = 79 m = 2.1266 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Column 18 2.1266 b = 73 m = 2.3014 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 19 2.1266 2.3014 b = 71 m = 2.3662 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 20 2.1266 2.3014 2.3662 b = 67 m = 2.5075 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 21 2.1266 2.3014 2.3662 2.5075 b = 61 m = 2.7541 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 22 2.1266 2.3014 2.3662 2.5075 2.7541 b = 59 m = 2.8475 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 23 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 b = 53 m = 3.1698 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 24 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 b = 47 m = 3.5745 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 25 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 b = 43 m = 3.9070 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 26 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 b = 41 m = 4.0976 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 27 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 b = 37 m = 4.5405 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 28 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 b = 31 m = 5.4194 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 29 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 b = 29 m = 5.7931 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 30 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 b = 23 m = 7.3043 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 31 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 7.3043 b = 19 m = 8.8421 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 32 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 7.3043 8.8421 b = 17 m = 9.8824 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 33 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 7.3043 8.8421 9.8824 b = 13 m = 12.9231 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 34 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 7.3043 8.8421 9.8824 12.9231 b = 11 m = 15.2727 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 34 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 7.3043 8.8421 9.8824 12.9231 Column 35 15.2727 b = 7 m = 24 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 34 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 7.3043 8.8421 9.8824 12.9231 Columns 35 through 36 15.2727 24.0000 b = 5 m = 4.8000 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 34 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 7.3043 8.8421 9.8824 12.9231 Columns 35 through 37 15.2727 24.0000 4.8000 b = 3 m = 8 p = Columns 1 through 17 1.0060 1.0307 1.0701 1.1126 1.1275 1.2086 1.2263 1.2824 1.3228 1.4867 1.5413 1.5701 1.6311 1.6634 1.7320 1.8876 2.0241 Columns 18 through 34 2.1266 2.3014 2.3662 2.5075 2.7541 2.8475 3.1698 3.5745 3.9070 4.0976 4.5405 5.4194 5.7931 7.3043 8.8421 9.8824 ...

Assertion failed.

4   Fail
n = 999; p_correct = [1 0 0 0 0 0 0 0 0 0 3 0]; assert(isequal(factor_digits(n),p_correct))

b = 997 m = 1.0020 p = 1.0020 b = 991 m = 1.0081 p = 1.0020 1.0081 b = 983 m = 1.0163 p = 1.0020 1.0081 1.0163 b = 977 m = 1.0225 p = 1.0020 1.0081 1.0163 1.0225 b = 971 m = 1.0288 p = 1.0020 1.0081 1.0163 1.0225 1.0288 b = 967 m = 1.0331 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 b = 953 m = 1.0483 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 b = 947 m = 1.0549 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 b = 941 m = 1.0616 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 b = 937 m = 1.0662 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 b = 929 m = 1.0753 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 b = 919 m = 1.0871 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 b = 911 m = 1.0966 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 b = 907 m = 1.1014 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 b = 887 m = 1.1263 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 b = 883 m = 1.1314 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 b = 881 m = 1.1339 p = 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 b = 877 m = 1.1391 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Column 18 1.1391 b = 863 m = 1.1576 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 19 1.1391 1.1576 b = 859 m = 1.1630 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 20 1.1391 1.1576 1.1630 b = 857 m = 1.1657 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 21 1.1391 1.1576 1.1630 1.1657 b = 853 m = 1.1712 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 22 1.1391 1.1576 1.1630 1.1657 1.1712 b = 839 m = 1.1907 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 23 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 b = 829 m = 1.2051 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 24 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 b = 827 m = 1.2080 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 25 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 b = 823 m = 1.2139 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 26 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 b = 821 m = 1.2168 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 27 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 b = 811 m = 1.2318 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 28 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 b = 809 m = 1.2349 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 29 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 b = 797 m = 1.2535 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 30 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 b = 787 m = 1.2694 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 31 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 1.2694 b = 773 m = 1.2924 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 32 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 1.2694 1.2924 b = 769 m = 1.2991 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 33 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 1.2694 1.2924 1.2991 b = 761 m = 1.3127 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 34 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 1.2694 1.2924 1.2991 1.3127 b = 757 m = 1.3197 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 34 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 1.2694 1.2924 1.2991 1.3127 Column 35 1.3197 b = 751 m = 1.3302 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 34 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 1.2694 1.2924 1.2991 1.3127 Columns 35 through 36 1.3197 1.3302 b = 743 m = 1.3445 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 34 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 1.2694 1.2924 1.2991 1.3127 Columns 35 through 37 1.3197 1.3302 1.3445 b = 739 m = 1.3518 p = Columns 1 through 17 1.0020 1.0081 1.0163 1.0225 1.0288 1.0331 1.0483 1.0549 1.0616 1.0662 1.0753 1.0871 1.0966 1.1014 1.1263 1.1314 1.1339 Columns 18 through 34 1.1391 1.1576 1.1630 1.1657 1.1712 1.1907 1.2051 1.2080 1.2139 1.2168 1.2318 1.2349 1.2535 1.2694 1.2924 1...

Assertion failed.

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!