Bocard’s problem is to find values of m and n such that n!+1 = m2 For example, a pair (4, 5) solves the above equation. We have n = 4, m = 5. 4! + 1 = 24 + 1 = 25 = 52. A pair (n, m) that solves above is called Brown Number.… Read More »
A number of the form 2x + 1 (where x > 0) is prime if and only if x is a power of 2, i.e., x = 2n. So overall number becomes 22n + 1. Such numbers are called Fermat Number (Numbers of form 22n + 1). The first few Fermet numbers are 3, 5,… Read More »
Starting with any positive integer N, we define the Collatz sequence corresponding to N as the numbers formed by the following operations: N → N/2 ( if N is even) N → 3N + 1 (if N is odd) i.e. If N is even, divide it by 2 to get N/2. If N is odd,… Read More »
Consider below questions. How many spanning trees can be there in a complete graph with n vertices? How many labelled Trees (please note trees, not binary trees) can be there with n vertices? The answer is same for both questions. For n = 2, there is 1 tree. For n = 3, there are 3… Read More »
Most of the languages including C, C++, Java and Python provide the boolean type that can be either set to False or True. Consider below programs that use Logical Not (or !) operator on boolean. The outputs of above programs are as expected, but the outputs following programs may not be as expected if we… Read More »
We have discussed different methods to find nth Fibonacci Number.
Storage class of a variable determines whether the item has a global or local lifetime. In C, typedef is considered as a storage class like other storage classes (auto, register, static and extern),
Predict the output of following program.
Atomic Operation What is an atomic operation? An idea of atomic operation helps in understanding reentrancy, critical section, thread safety, synchronization primitives, etc… (we will have upcoming articles on each).
In C, a structure cannot have static members, but in C++ a structure can have static members.
const Behaviour in C and C++ In C, the const qualified identifiers will have external linkage, where as in C++ it will have internal linkage. For example,