Note: In all formulas, n is the number being tested for primality. In all formulas, n is the number being tested for primality. In all formulas, n is the number being tested for primality. In all formulas, n is the number being tested for primality. 1. Trial division test. Divide n by each prime from 2 to ceiling(n{\displaystyle {\sqrt {n}}}). 2. Fermat's Little Theorem. Warning: false positives are possible, even for all values of a. Choose an integer value for a such that 2 â¤ a â¤ n - 1. If an (mod n) = a (mod n), then n is likely prime. If this is not true, n is not prime.
Wait at least two years. Hereâs where you will need patience: You should wait at least 24 months to apply for a mortgage after bankruptcy. You may be able to get a mortgage after bankruptcy sooner, but the terms, like interest rates, won't be as attractive as they would be if you waited two years. Since you might be paying that mortgage interest for up to 30 years, you will save money if you wait long enough after the discharge to get a good interest rate. Tips for when you're ready to apply for a mortgage. After the two-year period, make sure you are fully prepared to apply for a loan. Your lender will want you to meet certain criteria before agreeing to lend you money: A good debt-to-income ratio, stability and time on the job.
Youâre usually staring at a seven-year wait from the foreclosure date for conventional loans. Borrowers who can show the foreclosure resulted from circumstances truly beyond their control may be able to qualify after three years. But youâll also need to make a down payment of at least 10%. Following a short sale or a deed-in-lieu, itâs typically a four-year wait unless there were extenuating circumstances.