Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 Help Me ! » Identifying primes in a spreadsheet » 2008-04-07 11:20:35

Euclid
Replies: 3

I have this algorithm that allows conditional formatting in Excel.  If the cell contains a prime number then the cell's background colour is blue.  If it is composite it is white.  It is really handy.  I did not write it and I want to port it over to run on Open Office's Calc but it does not work.  It only identifies 2 and 3 as prime.  Anyone any ideas why it fails?

Here it is.  I think the original author of this is  Bob Umlas.  Quite an amazing piece of code.

=OR(A1=2,A1=3,ISNA(MATCH(TRUE,A1/ROW(INDIRECT("2:"&INT(SQRT(A1))))=INT(A1/ROW(INDIRECT("2:"&INT(SQRT(A1))))),0)))

Board footer

Powered by FluxBB