Maybe you should specify the required precision in the problem description.
OK, I added a sentence, thanks.
different matlab fnction used to solve this problem
lol ! need a translator for this solution!
This solution should provide minimal rounding error since it's done in an essentially symbolic domain and then evaluated at the very end, but it doesn't satisfy the test cases. *sigh*
The sequence is strictly positive. (Not easy to see, but true). If your pn's get negative at some higher n, you still have the roundoff problem. It would be indeed avoided if the integer calculation within the loop was exact, but the numbers quickly become larger than the 48bit mantissa of a double.
Return a list sorted by number of occurrences
Prime factor digits
Twins in a Window
Selecting books on MATLAB for experts and beginners (blindfolded)
Differential equations I
This is a palindrome and so am I
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office