Algorithmic mathematics
50 original programming-style mathematics puzzles in number theory, digit algorithms, combinatorics, dynamic programming, paths and geometry. Solve using any method; submit only the final integer, not code.
50 active competition problems in this category. Select Load more problems to see the next set.
Start with the technique
Translate a large enumeration into states, invariants or periodic blocks.
Worked example
Count numbers in 1 through 34 that are congruent to 2 modulo 5.
Reasoning and solution
The valid values form 2,7,12,…,32. The last multiplier is floor((34−2)/5)=6, so including multiplier zero gives 7 numbers. This avoids testing every number and scales to much larger limits.
Try the challenges below using the same ideas. You can read them without signing in.
Algorithmic mathematics problems
- Prime beyond the milestoneList all primes strictly greater than 1000 in ascending order. What is the 50th prime on that list? Submit the prime itself.Read and solve →
- Reversible primesA reversible prime is a prime p whose decimal digit reversal is a different prime (leading zeroes are dropped after reversal). Among reversible primes strictly greater than 1000, what is the 80th smallest?Read and solve →
- Prime digits checksumFor each prime p at most 75000, keep p if the sum of its decimal digits is also prime. Return the sum of all kept primes, modulo 1000003.Read and solve →
- Special eight-step prime gapsFor primes p and q that are consecutive in the increasing list of ALL primes, count pairs with p < 100000, q-p = 8, and the final decimal digit of p equal to 9. The value of q may exceed 100000.Read and solve →
- Four-factor digit targetFind the smallest integer n strictly greater than 100000 whose prime factorization contains exactly four DISTINCT prime factors and whose decimal digits sum to 19. Exponents do not count toward the number of distinct prime factors.Read and solve →
- Twisted power checksumFor every integer k from 1 through 4200, calculate k^(2k+1). What is the remainder when their sum is divided by 1000003?Read and solve →
- Polynomial residuesHow many integers n with 1 <= n <= 300000 satisfy n^2 + 3n + 7 congruent to 0 modulo 997?Read and solve →
- Linear congruential jumpDefine x_0 = 37 and x_(n+1) = (61*x_n + 17) mod 1000003. Calculate x_200000.Read and solve →
- Four-clock alignmentFind the smallest nonnegative integer x such that x mod 11 = 5, x mod 13 = 7, x mod 17 = 9, and x mod 19 = 0.Read and solve →
- Coincident modular cyclesHow many integers n with 1 <= n <= 1000000000000 satisfy both 7^n congruent to 1 modulo 1013 and n congruent to 2 modulo 9?Read and solve →
- Two threes and a checksumHow many integers from 1 through 200000 inclusive have the digit 3 occurring exactly twice in their usual decimal representation and a decimal digit sum divisible by 7?Read and solve →
- Increasing odd-ended digitsAmong five-digit positive integers whose digits are strictly increasing from left to right, sum those whose final digit is odd. Return that sum modulo 1000003.Read and solve →