Test if a number is prime

blank


=IF(C9=2,"Prime",IF(AND(MOD(C9,ROW(INDIRECT("2:"&ROUNDUP(SQRT(C9),0))))<>0),"Prime","Not Prime"))
This is an array formula. Therefore, you must press CTRL SHIFT ENTER after entering the formula and whenever you edit it later. You must enter the test number in cell C9.


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top