# Tag Archives: number-theory

## Count of perfect squares of given length

Given an integer N, the task is to find the number of perfect squares of length N. Examples: Input: N = 1 Output: 3 Explanation:… Read More »

## Program to Convert Octal to Hexadecimal

Given an Octal number, the task is to convert it into a Hexadecimal number. Examples: Input: 47 Output: 27 Explanation: Decimal value of 47 is… Read More »

## Sum of product of all subsets formed by only divisors of N

Given a number N, the task is to find the sum of the product of elements of all the possible subsets formed by only divisors… Read More »

## Find all divisors of first N natural numbers

Given an integer N, the task is find all the divisors of numbers from 1 to N. Note: 1 ≤ N ≤ 100000 Exmaples: Input:… Read More »

## Find K numbers with sum equal to N and sum of their squares maximized

Given two integers N and K, the task is to find K numbers(A1, A2, …, AK) such that ∑i=1KAi is equal to N and ∑i=1KAi2… Read More »

## Determine whether the given integer N is a Peculiar Number or not

Given an integer N, our task is the determine if the integer N is Peculiar Number. If it is then print “yes” otherwise output “no”.… Read More »

## Split N natural numbers into two sets having GCD of their sums greater than 1

Given an integer N, the task is to create two sets of distinct elements from 1 to N such that the gcd of their respective… Read More »

## Ternary number system or Base 3 numbers

A number system can be considered as a mathematical notation of numbers using a set of digits or symbols. In simpler words, the number system… Read More »

## Transform N to Minimum possible value

Given two numbers and N and D. Apply any of two below operations to N: add D to N change N to digitsum(N), where digitsum(N)… Read More »

## Count pairs in Array whose product is a Kth power of any positive integer

Given an array arr[] of length N and an integer K, the task is to count pairs in the array whose product is Kth power… Read More »

## Check if a N base number is Even or Odd

Given a number num in base N, check whether it is even or odd. Examples: Input: num = 10, N = 8 Output: Even Explanation:… Read More »

## Check if an Octal number is Even or Odd

Given an Octal number N, check whether it is even or odd. Examples: Input: N = 7234 Output: Even Input: N = 333333333 Output: Odd… Read More »

## Find if it is possible to make all elements of an array equal by the given operations

Given an array arr[], the task is to make all the array elements equal with the given operation. In a single operation, any element of… Read More »

## Check if N can be expressed as product of 3 distinct numbers

Given a number N. Print three distinct numbers (>=1) whose product is equal to N. print -1 if it is not possible to find three… Read More »

## Check if all Prime factors of number N are unique or not

Given a number N. The task is to check whether the given number N has unique prime factors or not. If yes then print YES… Read More »