U
U
uyrij2018-06-05 11:36:34
Python
uyrij, 2018-06-05 11:36:34

Algorithm for selecting a number such that it gives a final fraction (with a given n digits), while the reciprocal of the resulting fraction should be a final fraction?

you need to choose a number from 0 to 1 such that it is a final fraction, while the reciprocal number must also be a final fraction with a given number of digits (there are 8 such numbers in the table below).
in Excel, a simple selection is limited by the number of rows of the table 2 ^ 16, so the iteration step turns out to be a limit of 0.0001
, but with this iteration step of 10,000 rows, such a set of numbers is obtained

шаг	проц	обратное	округл до 5 знаков
0,0001	0,9999	1,0001000100010000000000000	1,0001000000000000000000000
0,0002	0,9998	1,0002000400080000000000000	1,0002000000000000000000000
0,0003	0,9997	1,0003000900270100000000000	1,0003000000000000000000000
0,0004	0,9996	1,0004001600640300000000000	1,0004000000000000000000000
0,0005	0,9995	1,0005002501250600000000000	1,0005000000000000000000000
0,0006	0,9994	1,0006003602161300000000000	1,0006000000000000000000000
0,0007	0,9993	1,0007004903432400000000000	1,0007000000000000000000000
0,0031	0,9969	1,0031096398836400000000000	1,0031100000000000000000000
0,0032	0,9968	1,0032102728731900000000000	1,0032100000000000000000000
0,2	0,8	1,2499999999999900000000000	1,2500000000000000000000000
0,9142	0,0858	11,6550116550002000000000000	0,116550002

advise a ready-made algorithm
excel, python, preferably

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
longclaps, 2018-06-05
@uyrij

Bullshit.
For a number and its reciprocal to be finite decimals, they must be of the form 2^n*5^m, for example

2/5=0.4   и   5/2=2.5
25/1=25   и   1/25= 0.04

The only way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question