sorry everyone, there was an issue in my reference solution used to generate the test suite. I have corrected this now.
where is the solutions
Java + Signal processing aproach.
Ah feeling a little guilty :| ...
Unless my math (or counting) is wrong, the result of 1/17 by long division has a 16-digit (not 15) recurring cycle. I cannot find an error in my code or hand calculations. Any help?
I believe you are right, the current test results seem to use something similar to the current leading method which disregards the effect of 0's so it typically underestimates the cycle length when d>10...
I believe in the test problems the cycle lengths of 17,19,197,1977,12345 should be 16,18,98,658,822 instead...
And those are precisely the numbers I am getting.
Wikipedia agrees with you: http://en.wikipedia.org/wiki/Repeating_decimal#Cyclic_numbers
Count from 0 to N^M in base N.
Back to basics 21 - Matrix replicating
Television Screen Dimensions
Golomb's self-describing sequence (based on Euler 341)
Pig Latin to English Translator
Reverse the Words (not letters) of a String
ASCII Birthday Cake
Return the 'Size' of a String of Code
Read a Soroban Abacus
Find the treasures in MATLAB Central and discover how the community can help you!
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