Project Euler 38: Solving with Pen and Paper Like It’s 1899 🖊️

Project Euler 38: Solving with Pen and Paper Like It’s 1899 🖊️

In the age of compilers and cloud computing, it's easy to forget how powerful logic and a pencil can be. Project Euler Problem 38 — finding the largest 1 to 9 pandigital number formed as a concatenated product — is typically solved with code. But what if we couldn't code it? Could we solve it by Hand?

Surprisingly, yes. Let's dive into how to tackle this delightful puzzle the old-school way.


🧩 The Problem Statement

We want to find the largest 9-digit pandigital number (i.e., one that uses digits 1 to 9 exactly once) that can be formed as:

a concatenated = integer × 1 || integer × 2 || ... || integer × n

Where n > 1, and || means "concatenate the results."


🧠 Step-by-Step Reasoning

Here's how to break this down with logic and no laptop:

1. Understand the Constraints

  • We need exactly four digits.
  • No repeats.
  • No zeroes.
  • Each will be used only once.

2. Start from the Top

Because we want the largest number, it probably starts with 9. So let's try 4-digit numbers beginning with 9. Why four digits?

3. Think in Terms of Digit Count

Let's assume the base number is x digits long, and we multiply it by (1, 2, ..., n) until we hit exactly nine digits total.

  • A 1-digit number, like 9, → 9 × (1, 2, 3, 4, 5) might work.
  • A 2-digit number like 91 → digits add up fast, but might still work.
  • A 4-digit number like 9327 →
    • ×1 = 4 digits
    • ×2 = 5 digits
    • 4 + 5 = 9 digits ✅

So let's focus on 4-digit numbers and multiply them by 1 and 2.

🧠 Digits Available: {1, 2, 3, 4, 5, 6, 7, 8, 9}
Total = 9 digits
We're fixing the first digit as 9, so we’re left with:

8 digits to choose from for the remaining 3 positions

✅ Counting
First digit: 9 (fixed)

Second digit: choose 1 of 8 (excluding 9)

Third digit: choose 1 of remaining 7

Fourth digit: choose 1 of remaining 6

Total=1×8×7×6= 336

✅ Final Answer:
There are 336 valid 4-digit numbers that:

Start with 9

Use digits 1–9 (no zero)

Have no repeated digits


✍️ Example Walkthrough (By Hand)

Let's try a candidate: 9327

  • 9327 × 1 = 9327
  • 9327 × 2 = 18654
  • Concatenate: 932718654

Is this pandigital?

Check manually:
✔️ 1
✔️ 2
✔️ 3
✔️ 4
✔️ 5
✔️ 6
✔️ 7
✔️ 8
✔️ 9
✔️ No zeroes
✔️ No repeats

Bingo!


🗃️ Systematic Exploration Table

Create a handwritten table to test other candidates:

Base×1×2ConcatPandigital?
9182918218364918218364❌ Repeats
9234923418468923418468❌ Repeats
9327932718654932718654✅ Yes
9876987619752987619752❌ Repeats

Take your time. Cross-check digits. Circle good candidates.


🏁 The Final Answer

After some searching and manual checking, you'll find:

932718654
is the largest 1–9 pandigital number formed as the concatenated product of (9327 × 1 || 9327 × 2).

All without a single line of code.


💡 Why This Matters

Solving puzzles like this by Hand:

  • Sharpens logic skills.
  • Builds appreciation for digit-based reasoning.
  • Brings you closer to the problem than a program ever could.

Sure, a few lines of Python can brute-force the answer. But the satisfaction of cracking it with only a pencil and patience? Priceless.


🧠 Challenge for You

Try solving Euler Problem 52 or 41 by Hand. They're also digit-based and rewarding.

Or better yet — give this one a go without reading this solution and see where your logic takes you!

The Fascinating World of Pandigital Multiples
Ever wondered how numbers can combine in surprising ways to reveal hidden patterns? Welcome to the story of pandigital multiples—a playful intersection of arithmetic and puzzling beauty that anyone can appreciate. What Are Pandigital Numbers? * Pandigital simply means a number that uses each of the digits from 1 through

Previous

Programmatically Finding Pandigital Multiples
In this post we’ll go step by step through a clear, Python-based approach to solve the “concatenated pandigital multiples” problem. We’ll explain each part in simple terms, provide complete code examples, and ensure every detail is fully understandable—even if you’re new to programming. 1. Restating the

Next