Advertisement
ksmk99

Reciprocal cycles #26

Sep 16th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. //A unit fraction contains 1 in the numerator.The decimal representation of the unit fractions with denominators 2 to 10 are given:
  9.  
  10. //1/2   =   0.5
  11. //1/3   =   0.(3)
  12. //1/4   =   0.25
  13. //1/5   =   0.2
  14. //1/6   =   0.1(6)
  15. //1/7   =   0.(142857)
  16. //1/8   =   0.125
  17. //1/9   =   0.(1)
  18. //1/10  =   0.1
  19. //Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle.It can be seen that 1/7 has a 6-digit recurring cycle.
  20.  
  21. //Find the value of d< 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
  22. namespace _26
  23. {
  24.     class Program
  25.     {
  26.         static void Main(string[] args)
  27.         {
  28.             BigInteger a =(BigInteger.Pow(10,982)-1)/983;
  29.             Console.WriteLine(a.ToString().Length);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement