A Vedic mathematics technique to calculate 1/N for N ending in 1, 3, 7 or 9

The following algorithm is applied (pseudo-code) :

  1. Let K be the smallest number that when multiplied by N results in a number ending with 9. This will be 9, 3, 7, and 1 for N ending in 1, 3, 7, and 9 respectively.
  2. Let O be the osculator for N calculated according to the procedure descibed here.
  3. Let T be K(N-1)
  4. Initialize two variables X and D to K.
  5. Chop off the least significant digit of X.
  6. Add D*O to X.
  7. Check if X equals T, if so, subtract every digit in the result from 9, prepend the resulting sequence to the result and we are done.
  8. Prepend D to the result.
  9. Set D to the least significant digit of X.
  10. If X equals K and D equals K then we are finished.
  11. Goto step 5

Examples:

Calculate 1/19

K = 1
O = 2
T = 18

Result               | D | X  |
---------------------|---|----|
0                    | 1 |  1 |
0.1                  | 2 |  2 |
0.21                 | 4 |  4 |
0.421                | 8 |  8 |
0.8421               | 6 | 16 |
0.68421              | 3 | 13 |
0.368421             | 7 |  7 |
0.7368421            | 4 | 14 |
0.47368421           | 9 |  9 |
0.947368421          |   | 18 |

Here X equals T so we subtract each digit from 9

  999999999
- 947368421
= 052631578

Prepend that to the result getting 0.052631578947368421...
Calculate 1/47
K = 7
O = 33
T = 322

Result                    | D | X   |
--------------------------|---|-----|
0                         | 7 |   7 |
0.7                       | 1 | 231 |
0.17                      | 6 |  56 |
0.617                     | 3 | 203 |
0.3617                    | 9 | 119 |
0.93617                   | 8 | 308 |
0.893617                  | 4 | 294 |
0.4893617                 | 1 | 161 |
0.14893617                | 9 |  49 |
0.914893617               | 1 | 301 |
0.1914893617              | 3 |  63 |
0.31914893617             | 5 | 105 |
0.531914893617            | 5 | 175 |
0.5531914893617           | 2 | 182 |
0.25531914893617          | 4 |  84 |
0.425531914893617         | 0 | 140 |
0.0425531914893617        | 4 |  14 |
0.40425531914893617       | 3 | 133 |
0.340425531914893617      | 2 | 112 |
0.2340425531914893617     | 7 |  77 |
0.72340425531914893617    | 8 | 238 |
0.872340425531914893617   | 7 | 287 |
0.7872340425531914893617  | 9 | 259 |
0.97872340425531914893617 |   | 322 |

Here X equals T so we subtract each digit from 9

  99999999999999999999999
- 97872340425531914893617
= 02127659574468085106382

Prepend that to the result getting 0.0212765957446808510638297872340425531914893617...
Calculate 1/37
K = 7
O = 26
T = 252

Result  | D | X   |
--------|---|-----|
0       | 7 | 7   | 
0.7     | 2 | 182 |
0.27    | 0 | 70  |
0.027   | 7 | 7   |

Here we have X = D = K so we are done and the answer is 0.027...
Note that we did not reach the condition X = T, so we do not perform the subtraction of digits from 9.


Although this can get cumbersome when O is large, it can be performed mentally with only addition and multiplication. Nevertheless, the number theoretical aspect of how this technique works is of more value than any claim to rapid calculation. Some additional information and a related technique can be found here.