## Sum of first n odd numbers in O(1) Complexity

Given the sequence of odd numbers 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, …. Find the sum of first n… Read More »

- Ternary number system or Base 3 numbers
- Find all divisors of first N natural numbers
- Find the largest composite number that divides N but is strictly lesser than N
- Check whether count of odd and even factors of a number are equal
- Split N natural numbers into two sets having GCD of their sums greater than 1
- Count of unique digits in a given number N
- Check if a number is Prime, Semi-Prime or Composite for very large numbers
- Split a number as sum of K numbers which are not divisible by K
- Transform N to Minimum possible value
- Sum of GCD of all numbers upto N with N itself
- Count of perfect squares of given length
- Program to Convert Octal to Hexadecimal
- Find two numbers whose difference of fourth power is equal to N
- Count of nodes having odd divisors in the given subtree for Q queries
- Largest number M less than N such that XOR of M and N is even
- Check if N can be expressed as product of 3 distinct numbers
- Sum of product of all subsets formed by only divisors of N
- Sum of Hamming difference of consecutive numbers from 0 to N | Set 2
- Determine whether the given integer N is a Peculiar Number or not
- Count of triplets in a given Array having GCD K
- Check if N can be obtained by repetitive addition or subtraction of two given numbers
- Check if all Prime factors of number N are unique or not
- Find K numbers with sum equal to N and sum of their squares maximized
- Sum of all divisors from 1 to N | Set 2
- Last digit in a power of 2
- Program to Convert BCD number into Decimal number
- Find pairs of elements from two different arrays whose product is a perfect square
- Find if it is possible to make all elements of an array equal by the given operations
- Count pairs in Array whose product is a Kth power of any positive integer
- Count of subsequences of length 4 in form (x, x, x+1, x+1) | Set 2

Given the sequence of odd numbers 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, …. Find the sum of first n… Read More »

Given three integers A, B and K. We need to find no. of K-prime numbers in the range [A, B]. A number is called K-prime… Read More »

Fermat’s little theorem states that if p is a prime number, then for any integer a, the number a p – a is an integer… Read More »

Given a positive integer ‘n’ and query ‘q’. Print all the divisors of number ‘n’. Input: 6 Output: 1 2 3 6 Explanation Divisors of… Read More »

Given three numbers, our task is to find the largest number by which when given 3 numbers are divided leads to same remainder. It may… Read More »

Given a list of N numbers, Find two numbers such that the product of the two numbers has the maximum number of factors. Formally given… Read More »

Given two numbers a and b find all x such that a % x = b . Examples: Input : a = 21, b =… Read More »

Given a positive number N. We need to find number(s) such that sum of digits of those numbers to themselves is equal to N. If… Read More »

We have a number n. We need to find whether number n can be represented by the sum of two squares. Examples : Input :… Read More »

Given an positive large integer n. Count the number of positive divisors of n2 which are not divisible by any divisor of n(1 <= n… Read More »

Given a number, find the numbers (smaller than or equal to n) which are both Fibonacci and prime. Examples: Input : n = 40 Output:… Read More »

Given two numbers w and m, we need to determine whether it is possible to represent m in terms of powers of w. The powers… Read More »

Given an positive even integer ‘n’. Count total number of ways to express ‘n’ as sum of even positive integers. Output the answer in modulo… Read More »

We are given a number N. We need to check if the given number N can be represented as sum of two Great numbers. If… Read More »

Given two numbers k and n, find the largest power of k that divides n! Constraints: K > 1 Examples: Input : n = 7,… Read More »