#Generate list of prime numbers series#
14th Fibonacci number in the series that has 31 as the first 2 numbers is 2027041 C Prime Number prime number program in c - Prime number is a number that is greater than 1 and divided by 1 or itself.In other words, prime numbers cant be divided by other numbers than itself or 1.For example- 2, 3, 5, 7, 11, 13, 17, 19, 23. Therefore, the last number of a Fibonacci series i.e. 34th Fibonacci number in the series that has as the first 2 numbers is 13158006689ġst prime list=Ģnd prime list generated form combination of 1st prime list = In this example we are using set comprehension to iterate through the numbers 2 through 7. The function range(2, 8) will generate the numbers 2-7. noprimes set(j for i in range(2, 8) for j in range(i2, 50, i)) We are using a set in this case because we only want to include each multiple once. Therefore, if we want to generate a list of non-primes under 50 we can do so by generating multiples. 14th Fibonacci number in the series that has 31 as the first 2. A prime number is one that is only divisible by 1 and itself. Last number of a generated Fibonacci series.ġst prime list = Ĭombination of all the primes = Ģnd prime list= 2nd prime list generated form combination of 1st prime list 3137, 5953, 5347, 6761, 3761, 4337, 6737, 6131, 3767, 4759, 4153, 3167, 4159, 6143 smallest prime in 2nd list3137. One line containing two space separated integers n1 and n2. Print the last number of a Fibonacci series as an output A prime sieve works by creating a list of all integers up to a desired. Find smallest (a) and largest (b) number from the 2nd generated list, also count of this list.Ĭonsider smallest and largest number as the 1st and 2nd number to generate Fibonacci series respectively till the count (number of primes in the 2nd list). In computational number theory, a variety of algorithms make it possible to generate prime. Find prime numbers between n1 and n2, then make all possible unique combinations of numbers from the prime numbers list you found in step 1.įrom this new list, again find all prime numbers.