Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace Fibonacci_Divisibility
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] lines = System.IO.File.ReadAllLines(@"Input.txt");
- var numbers = lines[1].Split(' ').Select(Int32.Parse).ToArray();
- string cuccli = "";
- foreach (int num in numbers)
- {
- int i = 1;
- while (FibonacciIteravite(i) % num != 0)
- {
- i++;
- }
- cuccli += i.ToString();
- }
- Console.ReadKey();
- }
- static System.Numerics.BigInteger FibonacciIteravite(int n)
- {
- System.Numerics.BigInteger current = 1;
- System.Numerics.BigInteger previous = 0;
- for (int i = 1; i <= (n - 1); i++)
- {
- System.Numerics.BigInteger temp = current + previous;
- previous = current;
- current = temp;
- }
- return current;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement