

Repeat the process (which has been called "Half Or Triple Plus One") indefinitely. If n is odd, multiply it by 3 and add 1 to obtain 3n + 1. If n is even, divide it by 2 to get n / 2. The conjecture can be summarized as follows. The conjecture is also known as the 3n + 1 conjecture. Output : Īccording to Wikipedia, the Collatz conjecture is a conjecture in mathematics named after Lothar Collatz, who first proposed it in 1937. Write a Python program where you take any positive integer n, if n is even, divide it by 2 to get n / 2. Therefore all the leading zeros will be omittedĢ3. Note : The result will not be unique for every number for example 31 is a reversed form of several numbers of 13, 130, 1300 etc. Write a Python program to compute the sum of the two reversed numbers and display the sum in reversed form. is a geometric sequence with common ratio 1/2.Ģ2. is a geometric progression with common ratio 3. In mathematics, a geometric progression or geometric sequence is a sequence of numbers where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the common ratio.įor example, the sequence 2, 6, 18, 54. Write a Python program to check a sequence of numbers is a geometric progression or not. is an arithmetic progression with common difference of 2.Ģ1. In mathematics, an arithmetic progression or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is constant.įor example, the sequence 5, 7, 9, 11, 13, 15. Write a Python program to check a sequence of numbers is an arithmetic progression or not. Write a Python program to reverse the bits of an integer (32 bits unsigned). Write a Python program to reverse the digits of an integer.
Note : Numbers in the additive sequence cannot have leading zeros.ġ8.

In the above sequence 6 + 6 =12, 6 + 12 = 18, 12 + 18 = 30.Īlso, you can split a number into one or more digits to create an additive sequence. Sample additive sequence: 6, 6, 12, 18, 30 The additive sequence is a sequence of numbers where the sum of the first two numbers is equal to the third one. Write a Python program to find whether it contains an additive sequence or not. Go to the editorįor example given number is 59, the result will be 5.ġ7. Write a Python program to add the digits of a positive integer repeatedly until the result has a single digit. Write a Python program to find two elements once in a list where every element appears exactly twice in the list.

Write a Python program to find the single element appears once in a list where every element appears four times except for one. Write a Python program to find the single element in a list where every element appears three times except for one. Write a Python program to find the single number in a list that doesn't occur twice. Note : The returned value will be an 'integer'ġ2. Write a Python program to compute and return the square root of a given 'integer'. Write a Python program to find three numbers from an array such that the sum of three numbers equal to a given number. Note : Find the unique triplets in the array.ġ0. Write a Python program to find three numbers from an array such that the sum of three numbers equal to zero. Write a Python program to find missing numbers from a list. Write a Python program to find a missing number from a list. Write a Python program to check if a number is a power of a given base. Write a Python program to check if an integer is the power of another integer. Write a Python program to check if a number is a perfect square. Write a Python program to check if a given positive integer is a power of four. Write a Python program to check if a given positive integer is a power of three. Write a Python program to check if a given positive integer is a power of two.
