description: Today, my friend and I teamed up to tackle 16 fundamental looping and number-theory problems in JavaScript. Here is our Day 1 roadmap!
tags: JavaScript, programming, logic, learning
š The Journey Begins: Day 1 of Looping & Logic
Today was an intense and highly productive day! My friend and I teamed up to push our programming logic to the next level. We decided to stop just reading code and start building logic from scratch.
We set a goal to complete 16 foundational looping and number-theory programs in Python. Working together made debugging faster and keeping each other accountable so much easier.
Since we spent all our energy crushing the logic, Iām keeping this blog brief, but I wanted to share the exact problem set we conquered today. If you are a beginner looking to build strong analytical skills, try solving these!
š The Day 1 Challenge List
We broke our challenges into two major categories: Pattern & Sequence Generation, and Number Properties & Theory.
Part 1: Sequence & Series Generation
-
Constant Series: Print
1 1 1 1 1using a loop. -
Linear Series: Print consecutive numbers
1 2 3 4 5. -
Odd Numbers: Print the first five odd numbers
1 3 5 7 9. -
Multiples of 3: Print the sequence
3 6 9 12 15.
Part 2: Number Theory & Divisibility
- Common Multiples (AND): Find and print numbers that are multiples of both 3 and 5.
- Combined Multiples (OR): Find and print numbers that are multiples of either 3 or 5.
- Divisors Finder: Find all the mathematical divisors of a given number.
- Count Divisors: Calculate the total number of divisors for a specific input.
- Prime Number Check: Determine if a given number is prime (only divisible by 1 and itself).
Part 3: Digit Manipulation & Special Numbers
- Reverse Printing: Take a number and print its digits in reverse order dynamically.
- Count Digits: Count how many total digits are in a given number.
- Sum of Digits: Extract and sum all individual digits of a number.
-
Reverse the Number: Mathematically reverse an integer (e.g., turning
123into321). -
Palindrome Number: Check if a number reads the same backward as forward (like
121). - Armstrong Number: Verify if the sum of its digits raised to the power of the number of digits equals the original number (e.g., $153 = 1^3 + 5^3 + 3^3$).
- Neon Number: Check if the sum of the digits of its square equals the original number (e.g., $9^2 = 81$, and $8 + 1 = 9$).
š” Key Takeaways from Today
-
Two Brains Are Better Than One: Group studying helped us catch edge cases (like handling
0or negative numbers in digit extraction) much faster. -
The Power of Modulo (
%): Whether it's finding divisors, checking primes, or stripping digits one by one, the%operator is an absolute king when working with loops. -
Building a Foundation: Special numbers like Armstrong and Neon seemed tricky at first, but once you master Digit Extraction (using
% 10and// 10), they become simple variations of the same core logic.
š¬ Let's Connect!
Have you solved these problems before? What was the hardest special number logic for you to crack when you started? Drop your thoughts in the comments!
Thank you---
Top comments (0)