Example from start to finish
Below 100, 99 is divisible by three and 98 is even. Ninety-seven passes every required divisor test, so it is the previous prime. This Previous Prime example can be compared with primality check.
Mathematical foundation
Previous-prime search moves downward from the integer immediately below the input. It returns the first candidate that satisfies the prime definition.
Reading previous prime correctly starts with the mathematical structure described here.
Steps without the calculator
Subtract one, skip even candidates other than two, and test divisibility through the square root until a prime is found.
Boundaries and common traps
Inputs of two or less have no smaller positive prime. The search excludes the starting number itself.
Reversing the displayed steps offers a quick independent check on this previous prime result.
Situations that fit the model
The result brackets a number from below, helps form prime gaps, and supplies a nearby smaller modulus or factor candidate.
Reading sensitivity and precision
The input labels—starting integer—encode the model used on this page. Write those labels beside source values when transferring a problem from paper or a spreadsheet. That small step catches transposed quantities and mixed units before they become a polished-looking previous prime.
Lowering the start can preserve the answer across a composite interval and then move it to an earlier prime. A one-field trial makes this relationship visible without reworking the entire example.
Choose rounding after considering how the result will be used. Comparison may need only a few significant digits, while a later multi-step calculation benefits from carrying more. In either case, retain the page's formula with the previous prime so the underlying definition remains visible.
Previous-prime search is directional; a general checker does not inspect neighboring integers. The distinction determines whether this page fits the original question.
If the number moves into a spreadsheet, give its cell a previous prime heading and retain the source values starting integer nearby. Context matters more than extra displayed digits.
Why downward searches need a boundary
The lower end of the prime sequence is exceptional. Two is the first prime, so a search starting at two or below cannot return a previous positive prime. Above that boundary, checking candidates in descending order guarantees that the first successful test is the greatest qualifying prime.