Deprecated: Return type of Dotenv\Repository\AbstractRepository::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forthrig/public_html/wp-content/plugins/anycomment/vendor/vlucas/phpdotenv/src/Repository/AbstractRepository.php on line 147

Deprecated: Return type of Dotenv\Repository\AbstractRepository::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forthrig/public_html/wp-content/plugins/anycomment/vendor/vlucas/phpdotenv/src/Repository/AbstractRepository.php on line 155

Deprecated: Return type of Dotenv\Repository\AbstractRepository::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forthrig/public_html/wp-content/plugins/anycomment/vendor/vlucas/phpdotenv/src/Repository/AbstractRepository.php on line 163

Deprecated: Return type of Dotenv\Repository\AbstractRepository::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forthrig/public_html/wp-content/plugins/anycomment/vendor/vlucas/phpdotenv/src/Repository/AbstractRepository.php on line 171

Deprecated: Return type of PhpOption\Some::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forthrig/public_html/wp-content/plugins/anycomment/vendor/phpoption/phpoption/src/PhpOption/Some.php on line 151

Deprecated: Return type of PhpOption\None::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forthrig/public_html/wp-content/plugins/anycomment/vendor/phpoption/phpoption/src/PhpOption/None.php on line 118
problem-list Archives | forthright48 https://forthright48.com/tag/problem-list/ learning never ends Sun, 28 Apr 2019 20:59:50 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.8 Lucas Theorem – Proof and Applications https://forthright48.com/lucas-theorem-proof-and-applications/?utm_source=rss&utm_medium=rss&utm_campaign=lucas-theorem-proof-and-applications https://forthright48.com/lucas-theorem-proof-and-applications/#comments Fri, 16 Nov 2018 08:48:24 +0000 https://forthright48.com/?p=352 Problem Given non-negative integers $N$, $K$ and a prime number $P$, find the value of: $$\binom{N}{K} \mod P$$ Sounds like a simple problem right? There are several ways to solve the problem, depending on the constraints of $N$, $K$, and $P$. Direct: If $N$, $K$ are really small, less than $12$, then we can calculate …

The post Lucas Theorem – Proof and Applications appeared first on forthright48.

]]>
https://forthright48.com/lucas-theorem-proof-and-applications/feed/ 1
Stars and Bars Theorem https://forthright48.com/stars-and-bars-theorem/?utm_source=rss&utm_medium=rss&utm_campaign=stars-and-bars-theorem https://forthright48.com/stars-and-bars-theorem/#respond Sun, 23 Sep 2018 15:32:54 +0000 https://forthright48.com/?p=307 Problem Given K variables, $a_1, a_2, a_3 \dots a_K$ and a value $N$, how many ways can we write $a_1 + a_2 + a_3 \dots a_K = N$, where $a_1, a_2, a_3 \dots a_K$ are non-negative integers? For example, if $K = 3$ and $N=2$, there are 6 solutions. a b c ----- 2 0 …

The post Stars and Bars Theorem appeared first on forthright48.

]]>
https://forthright48.com/stars-and-bars-theorem/feed/ 0
Prufer Code: Linear Representation of a Labeled Tree https://forthright48.com/prufer-code-linear-representation-of-a-labeled-tree/?utm_source=rss&utm_medium=rss&utm_campaign=prufer-code-linear-representation-of-a-labeled-tree https://forthright48.com/prufer-code-linear-representation-of-a-labeled-tree/#comments Sun, 28 Jan 2018 19:02:00 +0000 I guess this is going to be my first post (apart from the contest analysis’) which is not about Number Theory! It’s not about graph either, even though the title has “Tree” in it. This post is actually about Combinatorics. Prufer code, in my opinion, is one of the most underrated algorithms I have learned. …

The post Prufer Code: Linear Representation of a Labeled Tree appeared first on forthright48.

]]>
https://forthright48.com/prufer-code-linear-representation-of-a-labeled-tree/feed/ 2
Chinese Remainder Theorem Part 2 – Non Coprime Moduli https://forthright48.com/chinese-remainder-theorem-part-2-non-coprime-moduli/?utm_source=rss&utm_medium=rss&utm_campaign=chinese-remainder-theorem-part-2-non-coprime-moduli https://forthright48.com/chinese-remainder-theorem-part-2-non-coprime-moduli/#respond Sat, 18 Nov 2017 17:39:00 +0000 As promised on the last post, today we are going to discuss the “Strong Form” of Chinese Remainder Theorem, i.e, what do we do when the moduli in the congruence equations are not pairwise coprime. The solution is quite similar to the one we have already discussed in the previous post, so hopefully, it will …

The post Chinese Remainder Theorem Part 2 – Non Coprime Moduli appeared first on forthright48.

]]>
https://forthright48.com/chinese-remainder-theorem-part-2-non-coprime-moduli/feed/ 0
Euler Phi Extension and Divisor Sum Theorem https://forthright48.com/euler-phi-extension-and-divisor-sum/?utm_source=rss&utm_medium=rss&utm_campaign=euler-phi-extension-and-divisor-sum https://forthright48.com/euler-phi-extension-and-divisor-sum/#comments Sat, 26 Sep 2015 08:57:00 +0000 Previously we learned about Euler Phi Function. Today we are going to look at two theorems related to Euler Phi that frequently appears in CPPS. I am not sure whether these theorems have any official names, so I just made them up. These allow easy references so I will be using these names from now …

The post Euler Phi Extension and Divisor Sum Theorem appeared first on forthright48.

]]>
https://forthright48.com/euler-phi-extension-and-divisor-sum/feed/ 2
Segmented Sieve of Eratosthenes https://forthright48.com/segmented-sieve-of-eratosthenes/?utm_source=rss&utm_medium=rss&utm_campaign=segmented-sieve-of-eratosthenes https://forthright48.com/segmented-sieve-of-eratosthenes/#respond Mon, 07 Sep 2015 08:56:00 +0000 Problem Given two integers $A$ and $B$, find number of primes inside the range of $A$ and $B$ inclusive. Here, $1 \leq A \leq B \leq 10^{12}$ and $B – A \leq 10^5$. For example, $A = 11$ and $B = 19$, then answer is $4$ since there are $4$ primes within that range ($11$,$13$,$17$,$19$). …

The post Segmented Sieve of Eratosthenes appeared first on forthright48.

]]>
https://forthright48.com/segmented-sieve-of-eratosthenes/feed/ 0
Euler Totient or Phi Function https://forthright48.com/euler-totient-or-phi-function/?utm_source=rss&utm_medium=rss&utm_campaign=euler-totient-or-phi-function https://forthright48.com/euler-totient-or-phi-function/#comments Fri, 04 Sep 2015 11:38:00 +0000 I have been meaning to write a post on Euler Phi for a while now, but I have been struggling with its proof. I heard it required the Chinese Remainder Theorem, so I have been pushing this until I covered CRT. But recently, I found that CRT is not required and it can be proved …

The post Euler Totient or Phi Function appeared first on forthright48.

]]>
https://forthright48.com/euler-totient-or-phi-function/feed/ 4
Lowest Common Multiple of Two Number https://forthright48.com/lowest-common-multiple-of-two-number/?utm_source=rss&utm_medium=rss&utm_campaign=lowest-common-multiple-of-two-number https://forthright48.com/lowest-common-multiple-of-two-number/#respond Tue, 07 Jul 2015 18:02:00 +0000 https://forthright48.com/2015/07/07/lowest-common-multiple-of-two-number/ Problem Given two number A and B, find their lowest common multiple (LCM). We are trying to find the LCM of A and B. What is LCM? It is the smallest positive number which is divisible by both A and B. How do we find it? It is based on the formula that, $LCM(A,B) \times …

The post Lowest Common Multiple of Two Number appeared first on forthright48.

]]>
https://forthright48.com/lowest-common-multiple-of-two-number/feed/ 0
Euclidean Algorithm – Greatest Common Divisor https://forthright48.com/euclidean-algorithm/?utm_source=rss&utm_medium=rss&utm_campaign=euclidean-algorithm https://forthright48.com/euclidean-algorithm/#comments Wed, 01 Jul 2015 07:11:00 +0000 https://forthright48.com/2015/07/01/euclidean-algorithm-greatest-common-divisor/ Problem Given two number A and B, find the greatest number that divides both A and B. What we are trying to find here is the Greatest Common Divisor(GCD) of A and B. What is GCD? Like the name suggests, it the largest number ( let that be G ), that can divide both A …

The post Euclidean Algorithm – Greatest Common Divisor appeared first on forthright48.

]]>
https://forthright48.com/euclidean-algorithm/feed/ 5