How to get all decimals numbers to determine the reciprocal cycle of a division in Javascript?

Source: Repeating decimal - Wikipedia

image

I need to determine the length of a repeating decimal, but I cannot get the precise answer with Javascript.

Do you have an idea how to calculate it?

I am solving the problem 26 of Euler Project.
Source: https://www.freecodecamp.org/learn/project-euler/project-euler-problems-1-to-100/problem-26-reciprocal-cycles

dividing only is not going to work, JavaScript doesn’t do precision with that many decimals

you probably need to do smaller steps in that division, so that you get a precise result there

1 Like