Skip to content
Programs · Program 6-14

Q.Program 6-14: Program to check if the input number is prime or not.

Yanam CbseNCERTSubjective· 3mImportance★★★★★est
46% · 18/39 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Concept understanding — Finding Factors

Finding Factors: What Does It Really Mean?

Imagine you have 12 identical marbles. You want to arrange them in a neat rectangle — rows and columns, no gaps, no marbles left over. How many different rectangles can you make?

You could do 1 row of 12 marbles. That's 1×121 \times 12.

You could do 2 rows of 6 marbles. That's 2×62 \times 6.

You could do 3 rows of 4 marbles. That's 3×43 \times 4.

You could also do 4 rows of 3, 6 rows of 2, or 12 rows of 1 — but those are just the same rectangles turned sideways.

The numbers that multiply together to give 12 — 1, 2, 3, 4, 6, and 12 — are called the factors of 12. A factor is simply a whole number that divides another number exactly, leaving no remainder.

Note

The word "factor" comes from the Latin facere — "to make" or "to do." Factors are the numbers that make the product.


The Precise Definition

A factor of a given whole number nn is any whole number ff such that n÷fn \div f is also a whole number. Equivalently, there exists some whole number kk such that f×k=nf \times k = n.

For example, 3 is a factor of 12 because 12÷3=412 \div 3 = 4 (a whole number), and indeed 3×4=123 \times 4 = 12.

Important

Every whole number greater than 1 has at least two factors: 1 and itself. These are called the trivial factors.


How to Find All Factors of a Number

The most reliable method is pairwise checking — test every whole number from 1 up to the square root of nn. For each number that divides nn evenly, you get a pair: the divisor and the quotient.

Let's find all factors of 24.

  • Start at 1: 24÷1=2424 \div 1 = 24 → pair (1, 24)
  • 2: 24÷2=1224 \div 2 = 12 → pair (2, 12)
  • 3: 24÷3=824 \div 3 = 8 → pair (3, 8)
  • 4: 24÷4=624 \div 4 = 6 → pair (4, 6)
  • 5: 24÷5=4.824 \div 5 = 4.8 — not a whole number, so 5 is not a factor
  • 6: we already have it from the pair with 4
  • Stop at 24≈4.9\sqrt{24} \approx 4.9 — we've already checked up to 4, so we're done.

The factors of 24 are: 1, 2, 3, 4, 6, 8, 12, 24.

Tip

You only need to test divisors up to the square root. Why? Because if ff is larger than n\sqrt{n}, its partner k=n÷fk = n \div f must be smaller than n\sqrt{n} — and you've already found that partner.


Why This Matters …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.