1001Ferramentas
🔐Calculators

Prime Number Checker: Trial Division Test

Tells you whether a whole number is prime by dividing up to its square root, naming the first divisor when it is not. Practical up to about 10^12.

Is it prime?

Small-number primality testing

A positive integer n > 1 counts as prime when its only positive divisors are 1 and n itself. The plainest deterministic test is trial division: ask whether any prime p ≤ √n divides n. That runs in O(√n), which stays comfortable up to roughly 10¹². Take n = 97: since √97 ≈ 9.85, the only candidates are 2, 3, 5, 7, and none of them divides 97, so it's prime. When you need to screen a whole range, the Sieve of Eratosthenes precomputes every prime up to a bound in O(N log log N). For the much larger n behind cryptographic keys, Miller-Rabin returns a probabilistic answer in O(k log³ n), while AKS is deterministic in O(log⁶ n) but carries a constant too large to be useful in practice. Mersenne primes Mₚ = 2ᵖ − 1 get their own specialised test, Lucas-Lehmer. That's how the largest known prime turned up, M82589933 (24 million digits, GIMPS 2018).

Where primality testing is used

  • RSA key generation — the whole keypair rests on picking large random primes p, q.
  • OpenSSL, GnuPG and cryptographic libraries run Miller-Rabin against several bases every time they generate a key.
  • Diffie-Hellman / ElGamal rely on safe primes p = 2q + 1 where q is prime as well.
  • Competitive programming — number-theory problems lean on sieves and small primality checks all the time.

FAQ

Why test only up to √n? Write n = a · b with a ≤ b and you get a ≤ √n, so every composite is guaranteed a factor inside that range.

Is Miller-Rabin reliable? The error drops to 4^(−k) as you add random bases k. Crypto usually settles on k = 40, which pushes the odds of a wrong answer to astronomical levels.

Why is 1 not considered prime? Allowing it would wreck unique factorisation, since 6 = 2·3 = 1·2·3 = 1·1·2·3 … all become valid.

When should I use a sieve instead of trial division? Reach for the sieve once you need every prime up to N, or many tests across the same range. It spreads the cost over all the queries.

Related Tools

📏

Brown-Forsythe Test (Variances)

Computes the Brown-Forsythe test, a robust version of Levene's test for checking whether several groups share the same variance. The difference lies in one decisive detail: instead of measuring how far each point sits from the group mean, it uses the distance from the median. Because the median resists extreme values and skewed distributions, the test becomes much more reliable when the data aren't normal. Enter the groups: values by comma, groups by semicolon.

🚴

Cycling FTP Calculator (20-Minute Test)

Turns average power from an all-out 20-minute effort into Functional Threshold Power in watts, the 95% estimate used to set cycling training zones.

📏

Levene's Test (Equality of Variances)

Computes Levene's test, which checks whether several groups share the same variance — the homogeneity assumption that ANOVA and the t-test rely on. Instead of working with the original values, it transforms each data point into the absolute deviation from its group mean and runs an ANOVA on those deviations, gauging whether the spread differs across groups. It's more robust to non-normality than Bartlett's test. Enter the groups: values by comma, groups by semicolon.

💧

Hydrostatic Test Pressure

Calculate the hydrostatic test pressure of a pressure vessel by the (simplified) ASME rule, P_test = 1.3 · MAWP, from the maximum allowable working pressure MAWP (MPa). Before entering service (and periodically, at revalidations), every pressure vessel undergoes a HYDROSTATIC TEST: it is filled with WATER (not gas!) and pressurized ABOVE the operating pressure, to verify structural integrity and tightness before entrusting it with a hazardous fluid. ASME VIII Div. 1 (rule UG-99) requires a test pressure of 1.3 times MAWP (corrected by the allowable-stress ratio at test and design temperatures, simplified here). Using WATER is a fundamental safety matter: water is practically incompressible, so it stores very little energy when pressurized — if the vessel ruptures during the test, the failure is localized and relatively safe (it leaks, not explodes); whereas a compressed gas stores enormous energy and a rupture would be EXPLOSIVE, possibly lethal. The 1.3×MAWP test subjects the vessel to higher-than-operating stresses, revealing defects (cracks, bad welds, insufficient thickness) with margin, without reaching general yielding. Passing the hydrostatic test is a condition for the vessel's certification and operation. Enter the MAWP.

🏃

VO2 Max Cooper Test

Estimates VO2 max (mL/kg/min) from distance covered in the 12-minute Cooper test.

📊

Welch's t-test

Computes the Welch's t-test statistic, the two-sample t-test version that does NOT assume equal variances. Unlike the classic Student's t-test, it doesn't pool the variances into a single value, which makes it more reliable when the two groups have different spreads — the default recommendation in modern statistics. The degrees of freedom come from the Welch-Satterthwaite equation, usually fractional. Enter the mean, standard deviation and size of each of the two groups.

The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.