Number Theory Coding Problems

Prime numbers, GCD, and modular arithmetic

76
Total Problems
11
Easy
33
Medium
32
Hard
Start Practicing
πφgcdmod

Master DSA Topics - January, 2026

Practice problems across 75+ categories

Number Theory Coding Problems

Practice problems frequently asked at Number Theory 76 problems | 11 Easy | 33 Medium | 32 Hard

# Problem Difficulty Topics
46 Minimum Number of Operations to Make All Array Elements Equal to 1 Medium
ArrayMathNumber Theory
47 Minimum Split Into Subarrays With GCD Greater Than One Medium
ArrayMathDynamic Programming
48 Minimum Subarrays in a Valid Split Medium
ArrayMathDynamic Programming
49 Mirror Reflection Medium
MathGeometryNumber Theory
50 Most Expensive Item That Can Not Be Bought Medium
MathDynamic ProgrammingNumber Theory
51 Most Frequent Prime Medium
ArrayHash TableMath
52 Number of Beautiful Pairs Easy
ArrayHash TableMath
53 Number of Common Factors Easy
MathEnumerationNumber Theory
54 Number of Different Subsequences GCDs Hard
ArrayMathCounting
55 Number of Pairs of Interchangeable Rectangles Medium
ArrayHash TableMath
56 Number of Self-Divisible Permutations Medium
ArrayMathDynamic Programming
57 Number of Subarrays With GCD Equal to K Medium
ArrayMathNumber Theory
58 Number of Subarrays With LCM Equal to K Medium
ArrayMathNumber Theory
59 Prime In Diagonal Easy
ArrayMathMatrix
60 Prime Pairs With Target Sum Medium
ArrayMathEnumeration
Showing 46-60 of 76
1 2 3 4 5 6

Tutorials Library

Master any technology with our largest free online Library. Browse through 500+ tutorials across 10+ categories.

Python

Python Tutorial

Java

Java Tutorial

JavaScript

JavaScript

C++

C++ Tutorial

C#

C# Tutorial

Go

Go Tutorial

Rust

Rust Tutorial

TypeScript

TypeScript

Swift

Swift Tutorial

Kotlin

Kotlin Tutorial

Ruby

Ruby Tutorial

PHP

PHP Tutorial

C

C Tutorial

Scala

Scala Tutorial

Perl

Perl Tutorial

R

R Tutorial

Dart

Dart Tutorial

Lua

Lua Tutorial

MATLAB

MATLAB

Haskell

Haskell

Developer Toolbox

Powerful online tools to boost your productivity

public class MyFirstJavaProgram { Edit & Run

   /* This is my first java program.
    * This will print 'Hello, World!' as the output
    */

   public static void main(String []args) {
      System.out.println("Hello, World!"); // prints
   }
}

Start Coding in Seconds

Coding Ground For Developers

Code, Edit, Run and Share

Ignite your coding potential on Coding Ground - an immersive online platform for hands-on learning, collaboration, and skill development.