Maths and Number Systems
Practise 64 maths coding problems on digits, primes, GCD and LCM, Fibonacci numbers and base conversion in Python, C++, Java, JavaScript and TypeScript.
The Maths and Number Systems track takes you from the basics of working with the digits of a number to doing arithmetic in any base from 2 to 36. These are the number theory and number system questions that come up again and again in coding interviews, college exams and online contests, and each one is judged against hidden test cases in five languages.
What you will practise:
- Digits of a number: count, rotate, reverse and inspect digits, find the largest digit, and use digital roots and palindromic numbers, with problems such as Digit Span, Peak Digit and Digit Carousel.
- Primes, divisors and GCD: check whether a number is prime, list its divisors, find the GCD and LCM, and use a sieve to work with prime numbers, with problems such as Prime Verdict, Divisor Ladder and Twin Prime Count.
- Sequences and special numbers: Fibonacci numbers, Pythagorean triples, the bulb toggling puzzle, ugly numbers, and powers of three and four.
- Reading and writing numbers in a base: convert between decimal, binary, octal, hexadecimal and any base up to 36, and count the carries when you add.
- Arithmetic on digit strings: add, subtract and multiply very large numbers column by column, the way you do on paper, in any base.
- Other number systems: negabinary, balanced ternary, factorial base, mixed radix, Roman numerals and spreadsheet column labels.
This track suits beginners who know basic loops and conditions, and anyone revising number theory before interviews. Start with the digit problems, then move on to primes and number bases. Every problem comes with worked examples and clear constraints, so you can work out the idea yourself before you look for a solution.
- 6 sections
- 64 problems
What it covers
The path
- Old Numerals to NumberEasy
- Sheet Column LabelEasy
- Sheet Column NumberEasy
- Bits in a ChainEasy
- Base-B Digit Power CheckEasy
- Reverse in Base BEasy
- Mixed-Radix ClockMedium
- Balanced Ternary WriterMedium
- Factorial DigitsMedium
- Negabinary SumMedium
- Digit Tally Up To NMedium
- Minus-Two NotationMedium
- Zeros in Any BaseMedium
- Endless Number RibbonMedium
- Number to Old NumeralsMedium