# Tag Archives: number-theory

## Check whether a number is semiprime or not

Given a positive integer n. Find whether a number is a semiprime or not. Print True if number is semiprime else False. A semiprime is… Read More »

## Sum of all the factors of a number

Given a number n, the task is to find the sum of all the divisors. Examples : Input : n = 30 Output : 72… Read More »

## Program to find sum of series 1*2*3 + 2*3*4+ 3*4*5 + . . . + n*(n+1)*(n+2)

Given a positive integer n and the task is to find the sum of series 1*2*3 + 2*3*4 + 4*5*6 + . . .+ n*(n+1)*(n+2).… Read More »

## Program to find the sum of a Series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + … + (n*n)

You have been given a series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + … + (n*n), find out the sum of the… Read More »

## Numbers whose factorials end with n zeros

Given an integer n, we need to find the number of positive integers whose factorial ends with n zeros. Examples: Input : n = 1… Read More »

## Minimize the absolute difference of sum of two subsets

Given a number n, divide first n natural numbers (1, 2, …n) into two subsets such that difference between sums of two subsets is minimum.… Read More »

## Smallest n digit number divisible by given three numbers

Given x, y, z and n, find smallest n digit number which is divisible by x, y and z. Examples: Input : x = 2,… Read More »

## Sum of the series 1 + (1+3) + (1+3+5) + (1+3+5+7) + …… + (1+3+5+7+…+(2n-1))

Given a positive integer n. The problem is to find the sum of the given series 1 + (1+2) + (1+2+3) + (1+2+3+4) + ……… Read More »

## Check if a number can be written as sum of three consecutive integers

Given an integer n, the task is to find whether n can be written as sum of three consecutive integer. If yes, find the three… Read More »

## Sum of all divisors from 1 to n

Given a positive integer n. Find the value of where function F(i) for number i be defined as sum of all divisors of ‘i‘. Examples… Read More »

## Find largest prime factor of a number

Given a positive integer ‘n'( 1 <= n <= 1015). Find the largest prime factor of a number. Input: 6 Output: 3 Explanation Prime factor… Read More »

## Midy’s theorem

According to Midy’s theorem, if the period of a repeating decimal for , where p is prime and is a reduced fraction, has an even… Read More »

## Eulerian Number

In combinatorics, the Eulerian Number A(n, m), is the number of permutations of the numbers 1 to n in which exactly m elements are greater… Read More »

## Sum of squares of first n natural numbers

Given a positive integer N. The task is to find 12 + 22 + 32 + ….. + N2. Examples : Input : N =… Read More »

## Find first and last digits of a number

Given a number and to find first and last digit of a number. Examples: Input : 12345 Output : First digit: 1 last digit :… Read More »