Giuga Number Calculator

Number Theory

Giuga test for 30yes - Giuga number
prime factorisation2 x 3 x 5
prime-factor conditions met3 of 3
detailevery prime factor passes
How this was calculated
  1. A Giuga number is a composite, squarefree number such that for every prime factor p of n, p divides n/p - 1 - the condition ties each prime factor to the quotient that remains when it is divided out.
  2. The prime factorisation of 30 is 2 x 3 x 5, and the Giuga test checks the divisibility condition prime factor by prime factor: 3 of 3 conditions hold.
  3. So 30 is yes - Giuga number (every prime factor passes). A number with a squared prime factor can never be Giuga, because Giuga numbers are always squarefree.
  4. Only five Giuga numbers are known at all: 30, 858, 1,722, 66,198 and 2,214,408,306 - whether infinitely many exist is an open problem.

A Giuga number is a composite number that passes an unusually tight divisibility test: for every prime factor p of n, p must divide n/p - 1. The smallest example is 30 = 2 x 3 x 5, and it passes on all three factors - 30/2 - 1 = 14 is a multiple of 2, 30/3 - 1 = 9 is a multiple of 3, and 30/5 - 1 = 5 is a multiple of 5.

This Giuga number calculator works in two modes. Test mode factorises your number, reports how many of the prime-factor conditions hold, and names the factors where the test fails. List mode sweeps a range and returns every Giuga number in it - up to 100,000 there are exactly four: 30, 858, 1,722 and 66,198.

Giuga numbers are rare enough to be famous. Only five are known at all - the four above plus 2,214,408,306 - and whether the family is infinite is an open problem dating to Giuseppe Giuga's work in 1950. They are also easy to confuse with Carmichael numbers, and 30 itself shows why the two families differ.

Worked examples

Is 30 a Giuga number?

(Test a number · 30)

Giuga test for 30yes - Giuga number
prime factorisation2 x 3 x 5
prime-factor conditions met3 of 3
detailevery prime factor passes

Is 42 a Giuga number?

(Test a number · 42)

Giuga test for 42no
prime factorisation2 x 3 x 7
prime-factor conditions met1 of 3
detailfails at prime factor 3, 7

Giuga numbers up to 100,000

(List up to n · 100000)

Giuga numbers up to 100,00030, 858, 1,722, 66,198
count4
largest66,198
next Giuga number after this bound2,214,408,306

The prime-factor condition

The definition has three parts. The number must be composite, it must be squarefree (no prime factor appears twice), and for each prime factor p it must satisfy the congruence p | n/p - 1. All three parts matter: a prime fails the first, a number like 12 fails the second, and an ordinary squarefree composite like 42 fails the third - 42 = 2 x 3 x 7 passes at p = 2 but fails at p = 3 and p = 7.

The calculator reports the conditions individually, so a failure is always located. When 42 is tested it returns '1 of 3' conditions met and names 3 and 7 as the failing factors. That transparency is the point of the test mode: a Giuga verdict is a claim about every prime factor, and the page shows each one.

  • Composite and squarefree, always
  • One congruence per prime factor: p divides n/p - 1
  • 30 passes 3 of 3; 42 passes only 1 of 3

The known Giuga numbers

The complete list of known Giuga numbers is 30, 858, 1,722, 66,198 and 2,214,408,306. The gaps are part of the story: after 30 the next is nearly thirty times larger, and the fifth known example is already in the billions. Each new example has historically been found by smarter searches rather than by brute force, because the condition becomes harder to satisfy as the number of prime factors grows.

Every known Giuga number is even, squarefree and has at least three prime factors. List mode on this page reproduces the first four by direct testing up to 100,000, which is a useful sanity check on the definition: the sweep finds 30, 858, 1,722 and 66,198 and nothing else.

  • Known: 30, 858, 1,722, 66,198, 2,214,408,306
  • Up to 100,000: exactly the first four
  • All known examples are even with at least 3 prime factors

Giuga vs Carmichael numbers

Giuga numbers are often mentioned beside Carmichael numbers, the composite n with a^(n-1) = 1 mod n for every coprime a. The families are related - every Carmichael number that is also squarefree and satisfies Giuga's condition would sit in both - but they are not the same family, and 30 proves it: 30 is Giuga but not Carmichael, because it fails the Korselt condition at p = 3, where (30 - 1) mod (3 - 1) = 1 rather than 0.

Giuga originally studied the condition while looking for a primality test: he conjectured a characterisation of primes in terms of a sum over multiples, and the composite numbers passing his divisibility condition are the potential counterexamples. That origin is why the family carries his name and why each example is checked so carefully.

  • 30 is Giuga but not Carmichael
  • Korselt fails for 30 at p = 3
  • Giuga's condition began as a primality-test idea

How the test works

The computation is exact integer arithmetic throughout. The number is factorised, squared factors are rejected immediately, and each surviving prime factor is checked against the quotient n/p - 1. There is no approximation and no probabilistic step: the answer for any n up to 100,000 is a proof, not an estimate.

List mode applies the same test to every candidate in range. Because the test is cheap once factorisation is shared, a sweep to 100,000 finishes quickly and returns the four expected values. If you test a number with a squared factor, the page says so directly - squarefree failure is reported before the congruences are even checked.

  • Factorise, reject squared factors, check each prime
  • Exact integer arithmetic - no probabilistic step
  • List mode verified to 100,000

Why the squarefree condition comes first

It is tempting to skip straight to the congruences, but the squarefree requirement does real work. If a prime p appears squared in n, the quotient n/p still contains p, and the expression n/p - 1 is then coprime to p - so the congruence p | n/p - 1 can never hold. Squared factors are not a borderline case; they are an automatic disqualification, which is why the calculator checks them first and reports them separately.

That is also why a number like 12, despite its friendly factorisation 2 x 2 x 3, is dismissed instantly: the repeated 2 ends the test before any congruence is evaluated. The order of the checks on the page - factorise, reject squares, then test primes - mirrors the logic of the definition itself.

  • A squared prime makes its congruence impossible
  • 12 is rejected on the square, before any division test
  • Check order follows the definition

Reading the test-mode report

Test mode gives three pieces of information: the factorisation, the count of conditions met, and the detail line. Used together they tell you not just whether a number is Giuga but how it fails. A number failing on the squarefree check needs a different fix - none, it is simply out - while a squarefree number failing at one prime factor is a near miss of a specific, describable kind.

Try 30 and 42 side by side. Both are small, even and squarefree-adjacent in feel, but 30 returns 3 of 3 conditions met while 42 returns 1 of 3 with failures named at 3 and 7. The contrast is the fastest way to understand what the Giuga condition actually demands of each prime factor.

  • Factorisation, conditions met, failing primes
  • 30: 3 of 3 - 42: 1 of 3
  • Near misses are located, not just declared

Giuga's conjecture and the Agoh-Giuga equivalence

Giuga's name attaches to a second, deeper statement. He conjectured a characterisation of prime numbers through a sum involving Bernoulli numbers, and later work by Agoh showed the conjecture is equivalent to a statement about the very numbers on this page: the Agoh-Giuga conjecture fails exactly if a composite counterexample - intimately related to the Giuga condition - exists. That equivalence is why a small family of exotic composites carries a conjecture about all primes.

For the calculator's purposes the practical moral is simpler. The Giuga condition is a finite, exact check on a single integer, yet the family it defines is entangled with one of the classical unsolved characterisations of primality. Testing 30 or sweeping to 100,000 touches the shallow end of a genuinely deep pool.

  • Agoh-Giuga: a primality characterisation tied to this family
  • Five known examples, one big equivalence
  • Exact finite checks, deep open theory

Open problems

Two questions dominate. First, are there infinitely many Giuga numbers? Nobody knows - five examples in seventy years of searching suggests either extreme rarity or a hidden structural reason the family might be finite. Second, must a Giuga number be even? Every known example is, but no proof excludes an odd one.

There is also a quantitative race: the smallest Giuga number with a given number of prime factors grows ferociously, so progress comes from congruence-based search strategies rather than raw enumeration. A page like this one, which verifies the small end exhaustively, is the base camp for that larger search.

  • Infinitely many? Unknown
  • Must they be even? All known are; unproven
  • Progress comes from smarter searches, not brute force

FAQs

What is a Giuga number?

A composite, squarefree number n such that for every prime factor p of n, p divides n/p - 1. The smallest is 30.

Is 30 a Giuga number?

Yes. For 30 = 2 x 3 x 5, the values 30/2 - 1 = 14, 30/3 - 1 = 9 and 30/5 - 1 = 5 are divisible by 2, 3 and 5 respectively - 3 of 3 conditions hold.

What are the known Giuga numbers?

Only five are known: 30, 858, 1,722, 66,198 and 2,214,408,306.

Is 42 a Giuga number?

No. 42 passes the condition at p = 2 but fails at p = 3 and p = 7, so only 1 of its 3 conditions holds.

Are Giuga numbers the same as Carmichael numbers?

No. 30 is a Giuga number but not a Carmichael number: it fails the Korselt condition at p = 3.

Are there infinitely many Giuga numbers?

Unknown. Only five are known, and whether the family is infinite is an open problem.

Sources

Related calculators

Perfect Number Calculator
Classify a number as perfect, abundant or deficient by comparing it with the sum of its proper divisors (its aliquot sum).
Aliquot Sequence Calculator
Trace an aliquot sequence to its fate: termination at 0, a perfect fixed point, or an amicable or sociable cycle.
Prime Factorization Calculator
Break any whole number up to a trillion into its prime factors — with divisor count, divisor sum and largest prime factor.