P₁₀Math Education · Chapter 17
Lesson progress0 / 10 missions
Chapter 17 · Lesson 17.4

Build Prime Numbers from Digits and Optimize

用数字组成质数并求最优

Use leading-digit, final-digit, and digit-sum restrictions to build primes efficiently; then prove a minimum or maximum by checking every surviving construction.

Restrict first. Build carefully. Prove the optimum.
10 interactive missionsGrade 5No this lesson requiredCondition-based checking
Work saves in this browser.
Mission 1

Use digit restrictions before testing factors

Most digit constructions can be reduced sharply before any long primality test. Start with the first digit, last digit, and digit sum.

Not complete
No leading zeroA multi-digit prime must not be written with a leading zero. For example, 041 is not a three-digit prime; it is another way to write 41.
Possible final digitsA multi-digit prime can end only in 1, 3, 7, or 9.
Digit-sum filterIf the digit sum is a multiple of 3, a number greater than 3 is composite.
Then test factorsPassing quick filters makes a number a candidate, not automatically prime.

Digit evidence scanner

401
Leading digit
Final digit
Digit sum
Quick filters
Full result

Quick check

Need a hint? Start here

For a multi-digit prime, eliminate endings 0, 2, 4, 5, 6, 8 and multiples of 3. Passing these filters is only the start.

How to check my reasoning

Passing digit filters alone does not prove primality. For example 91 ends in 1 but equals 7×13. Ending digits 1,3,7,9; no; no.

Mission 2

Plan the worked example's 0–9 construction

Use every digit 0 through 9 exactly once to form several prime numbers. The goal is to make the sum of those primes as small as possible.

Not complete
Worked example 4

Use all ten digits exactly once

Form several prime numbers using the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 exactly once altogether. Minimize the sum of the primes.

Teal underline: one-digit primeGold underline: ending digitPurple underline: interior digit

original strategy

Why these roles help

To keep the total small, use the smallest primes as one-digit numbers whenever possible. The other digits must be placed where a multi-digit prime can legally use them.

Target structure
3 one-digit primes + 2 two-digit primes + 1 three-digit prime

This is the structure used by the worked example's minimum construction. Mission 4 checks the optimum exhaustively.

Record the worked example plan

Reveal all four reasoning steps first. These questions ask about this particular proposed structure; the full search later proves that it is optimal.

Need a hint? Start here

Digits 2 and 5 cannot end a multi-digit prime; 0 cannot lead one. Track the digit inventory as you assign roles.

How to check my reasoning

Use 2,3,5 alone; reserve 1,7,9 as endings. Zero cannot lead or end a prime. 2,3,5; endings 1,7,9; middle digit 0.

Mission 3

Build and audit a minimum construction

Enter any collection of primes. The checker accepts every arrangement that uses each digit exactly once and reaches the minimum total; it does not require one hard-coded original arrangement.

Not complete

Prime collection builder

Every number prime?
Digits 0–9 once?
No leading zero?
Number of primes
Total sum
Minimum reached?

Verify your construction

Enter a valid minimum collection in the builder before checking. Reordering the same primes does not create a different collection.

Need a hint? Start here

Check every digit is used once, then verify each number is prime, then add.

How to check my reasoning

Check every member is prime, then add. Order of members is irrelevant. Minimum 567; six primes in the worked example model 2,3,5,67,89,401.

Mission 4

Prove the minimum and find every optimum

The worked example displays one minimum construction. A complete digit-mask search can also test whether the minimum is unique.

Not complete

Why a bounded search is enough

  1. We already have a construction totaling 567.
  2. Any better construction would use only primes below 567.
  3. Generate every prime at most 567 whose own digits do not repeat.
  4. Combine only disjoint digit masks until all ten digits are covered.

Digit-mask idea

A prime such as 401 uses the mask for digits 4, 0, and 1. Two primes may be combined only if their masks do not overlap.

Complete optimization audit

Candidate primes ≤ 567
Minimum total
Optimal collections
Digits covered
Run the search to reveal the complete optimum set.

Read the audit

Run the complete optimization search before checking these answers.

Need a hint? Start here

A minimum needs both a legal construction and evidence that every smaller candidate fails. The digit-mask search covers disjoint inventories.

How to check my reasoning

A known total of 567 bounds every prime in an equally good or better collection. Minimum 567; two optimal collections; the other three-digit prime is 409.

Mission 5

Build the largest prime from a digit pool

For a maximum problem, test candidates from the largest place-value choices downward—but still verify primality.

Not complete
17 · Question 7

Choose three digits from 1, 2, 3, 4, 5, 8

Use three different digits to form the largest possible three-digit prime.

Prime-from-pool laboratory

Use 2–8 distinct available digits, from 0 through 9. Each candidate uses the chosen number of digits, with no repetition and no leading zero. “Permutations tested” includes ordered digit choices rejected for a leading zero.

Primes found
Smallest
Largest
Permutations tested
Run the generator.

Record the complete search

Set the pool to 1,2,3,4,5,8, choose length 3, and run the generator before checking.

Need a hint? Start here

Try the largest hundreds digit first; reject unsuitable endings and digit sums before trial division.

How to check my reasoning

Digits cannot repeat within a candidate. Test all eligible arrangements. Twelve primes; largest 853; three digits per candidate.

Mission 6

Prove that an entire digit family is composite

Sometimes every permutation fails for the same reason, so one invariant replaces hundreds of individual tests.

Not complete
Exercise 4

Can a nine-digit permutation of 1 through 9 be prime?

Use each digit 1, 2, 3, 4, 5, 6, 7, 8, and 9 exactly once, in any order.

Permutation invariant checker

987654321
Uses 1–9 once?
Digit sum
Remainder ÷ 9
Prime possible?
The order never changes the digit sum: 1 + 2 + ··· + 9 = 45, so every such nine-digit number is divisible by 9 and is greater than 9.

State the proof

Enter a valid permutation of digits 1 through 9 in the checker, then answer the proof questions.

Need a hint? Start here

Rearranging digits leaves their sum unchanged. A nine-digit number with digit sum 45 is a multiple of 9 greater than 9.

How to check my reasoning

Its digit sum is always 45, regardless of order. 45; one-digit composite divisor 9; no prime is possible.

Mission 7

Find two-digit primes made of prime digits

A complete family search checks every tens digit and every ones digit exactly once.

Not complete
Exercise 5

Two-digit primes whose digits are prime

How many two-digit numbers are prime and have a prime tens digit and a prime ones digit? The two digits may be equal; primality will decide which candidates survive.

Build a complete candidate list

Each digit comes from 2, 3, 5, 7. A two-digit prime cannot end in 2 or 5, so only eight candidates remain: 23, 27, 33, 37, 53, 57, 73, 77.

Check the eight candidates

27, 33 and 57 are multiples of 3; 77 = 7 × 11. The remaining numbers are 23, 37, 53, 73. To verify these, test primes up to their square-root boundaries: at most 2, 3, 5, 7. None divides them. There are exactly four.

Record the worked example family

Need a hint? Start here

The prime digits are 2, 3, 5, 7. A two-digit prime can end only in 3 or 7 from that list.

How to check my reasoning

A two-digit prime from this pool ends in 3 or 7. Reject 27,33,57,77. Four primes: 23,37,53,73.

Mission 8

Concatenate primes and solve the digit equation

Writing one number immediately after another is a place-value operation, not ordinary addition.

Not complete
17 · Question 11

Append a one-digit prime to a two-digit prime

Write the one-digit prime a to the right of the two-digit prime b. The resulting three-digit number is 87 times a. Find a + b.

10b + a = 87a

Algebraic reduction

10b = 86a
5b = 43a

The one-digit prime must be one of:

2357

Candidate audit

Run the audit.

Complete the construction

Run the four-candidate audit before checking these answers.

Need a hint? Start here

Appending one digit multiplies the original number by 10 before adding that digit.

How to check my reasoning

10b+a=87a gives 5b=43a. Test a=2,3,5,7. a=5; b=43; sum 48.

Mission 9

Prime-digit construction workshop

Correct all eight questions to complete the workshop.

Not complete

1. List the possible final digits of a multi-digit prime.

2. Use each digit 0–9 exactly once to form primes. What is the minimum possible total?

3. How many optimal prime collections use all digits 0–9 once?

4. What is the largest three-digit prime made from three of 1, 2, 3, 4, 5, 8?

5. Can a nine-digit permutation of 1 through 9 be prime?

6. List the two-digit primes whose two digits are prime.

7. Append one-digit prime a to two-digit prime b. The result is 87a. What is a?

8. How many primes are in either optimal 0–9 collection?

Workshop score0 / 8
Need a hint? Start here

Check the inventory, the primality of every part, and the requested minimum or maximum separately.

How to check my reasoning

Reordering one collection does not produce a new optimum. 1,3,7,9; 567; 2; 853; no; 23,37,53,73; 5; 6.

Mission 10

Exit ticket

Complete Missions 1–8, earn 8/8 in the workshop, and earn 5/5 on this exit ticket to unlock the certificate. The reflection is optional and not automatically graded.

Not complete

1. Minimum total using digits 0–9 exactly once in primes?

2. Number of optimal collections?

3. Largest three-digit prime using three different digits from 1,2,3,4,5,8?

4. Append one-digit prime a to two-digit prime b to make 87a. What is a+b?

5. Using digits 1, 4, 7 without repetition, what is the largest two-digit prime?

Exit score0 / 5

Optional reflection — not automatically graded

Certificate of completion

Prime-Digit Construction Optimizer

Grade 5 Mathematician

has completed Lesson 17.4 and demonstrated accurate digit restrictions, prime construction, complete enumeration, and minimum and maximum proofs.

Teaching notes

The original presents one minimum construction but does not state uniqueness; the digit-mask search is added instructional scaffolding and finds exactly two optimal unordered collections.

Need a hint? Start here

List two-digit arrangements, reject even endings, then try small prime divisors.

How to check my reasoning

Explain your method in the reflection box. The checker grades the answer; your explanation is for you to review.