Taxicab Numbers
The nth Taxicab number Taxicab(n), also called the n-th Hardy-Ramanujan number, is defined as the smallest number that can be expressed as a sum of… Read More »
The nth Taxicab number Taxicab(n), also called the n-th Hardy-Ramanujan number, is defined as the smallest number that can be expressed as a sum of… Read More »
Betrothed numbers are two positive numbers such that the sum of the proper divisors of either number is one more than (or one plus) the… Read More »
Given a number n, find the sum of first natural numbers. Examples : Input : n = 3 Output : 6 Explanation : Note that… Read More »
Given two integers a and b. The problem is to find the number of digits in the product of these two integers. Examples: Input :… Read More »
Given a number n, find sum of first n odd natural numbers. Input : 2 Output : 28 1^3 + 3^3 = 28 Input :… Read More »
Given a number n, find sum of first n even natural numbers. Examples: Input : 2 Output : 72 2^3 + 4^3 = 72 Input… Read More »
This approach is based on Wilson’s theorem and using the fact that factorial computation can be done easily using DP Wilson theorem says if a… Read More »
You are given a string, find its rank among all its permutations sorted lexicographically. Examples: Input : str[] = “acb” Output : Rank = 2… Read More »
Given a number, find minimum sum of its factors. Examples: Input : 12 Output : 7 Explanation: Following are different ways to factorize 12 and… Read More »
Pell numbers are numbers that are similar to the Fibonacci numbers and are generated by below formula Pn = 2*Pn-1 + Pn-2 with seeds P0… Read More »
Given a number of the form 11..1 such that number of digits in it is smaller than 10, find square of the number. Examples: Input… Read More »
Given a number n. We need find the number of ordered pairs of a and b such gcd(a, b) is b itself Examples : Input… Read More »
Given a really large number, break it into 3 whole numbers such that they sum up to the original number and count number of ways… Read More »
Questions based on various concepts of number theory and different types of number are quite frequently asked in programming contests. In this article, we discuss… Read More »
Round I Say millions of players are playing a game online and their scores keep changing. Every player is represented by ID and SCORE. How… Read More »