The task is to find the triangle of numbers arising from Gilbreath’s conjecture.
It is observed that given a sequence of prime numbers, a sequence can be formed by the absolute difference between the ith and (i+1)th term of the given sequence and the given process can be repeated to form a triangle of numbers. This numbers when forms the elements of Gilbreath conjecture triangle.
The Gilbreath triangle is formed as follows:
- Let us take primes: 2, 3, 5, 7.
- Now the difference between adjacent primes is: 1, 2, 2.
- Now the difference between adjacent elements is: 1, 0.
- Now the difference between adjacent elements is: 1.
- In this way, the Gilbreath triangle is formed as:
2 3 5 7 1 2 2 1 0 1
- This triangle will be read anti-diagonally upwards as
2, 1, 3, 1, 2, 5, 1, 0, 2, 7,
Input: n = 10 Output: 2, 1, 3, 1, 2, 5, 1, 0, 2, 7, Input: n = 15 Output: 2, 1, 3, 1, 2, 5, 1, 0, 2, 7, 1, 2, 2, 4, 11
- The (n, k) th term of the Gilbreath sequence is given by
- F(0, k) is the kth prime number where n = 0.
- Define a recursive function and we can map the (n, k)th term in a map and store them to reduce computation. we will fill the 0th row with primes.
- Traverse the Gilbreath triangle anti-diagonally upwards so we will start from n = 0, k = 0, and in each step increase the k and decrease the n if n<0 then we will assign n=k and k = 0, in this way we can traverse the triangle anti-diagonally upwards.
- We have filled the 0th row with 100 primes. if we need to find larger terms of the series we can increase the primes.
Below is the implementation of the above approach:
2, 1, 3, 1, 2, 5, 1, 0, 2, 7, 1, 2, 2, 4, 11,
- Goldbach's Weak Conjecture for Odd numbers
- Sum of all the numbers in the Nth row of the given triangle
- Sum of all the numbers present at given level in Pascal's triangle
- Sum of all the numbers present at given level in Modified Pascal’s triangle
- Lemoine's Conjecture
- Legendre's Conjecture
- Ramanujan–Nagell Conjecture
- Program to implement Collatz Conjecture
- Program for Goldbach’s Conjecture (Two Primes with given Sum)
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Maximum Sequence Length | Collatz Conjecture
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Trinomial Triangle
- Hosoya's Triangle
- Pascal's Triangle
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.