Cops and Robbers: Redacted Primality (Cops' Thread)

8086 DOS COM, 87 bytes, score 19/87 ~= 0.2183

Cracked by NieDzejkob

1└╣██1█╛ü ¼<█t<< u≈¼<█t█,0|/<██+ô≈ßô☺├δδâ√█|█╞█S█Y╣██9┘t█ë╪1╥≈±○╥t█Aδ∩╞█S█N┤█║S█═!├A

This is a COM program; expects number as a command line argument, outputs Y or N. Limit: 65535 because 16 bit processor (sizeof(int) would be 2). Newline is 0x0D 0x0A on this platform. Yes you count 20 █ instead of 19 █. One of them's a real █ and has not been substituted. Muhahaha.

The space in position 10 is actually a NUL byte. The symbol for NUL is the same as space in the old VGA font.

Swift 4, score 26 / 170 ≈ 0.153, safe

func p(n:Int)->Bool{func █(_ █:Int,_ █:Int)->Int{var h=(1...l).map{$0██m██
while(m=h.count,m██).1{h=[Int](h[█...])};return m}
return █>██&(█.███).index█j█n██0)>=█0}█=██l}

Try it online!

Intended Crack

func p(n:Int)->Bool{func j(_ l:Int,_ k:Int)->Int{var h=(1...l).map{$0},m=l
while(m=h.count,m>k).1{h=[Int](h[k...])};return m}
return n>1&&(2..<n).index{j(n,$0)>=$0}==nil}


func p(n:Int)->Bool{
  func j(_ l:Int,_ k:Int)->Int{    // Modulus function (l mod k)
    var h=(1...l).map{$0},m=l      //  Create an array h of size l
    while(m=h.count,m>k).1{        //  While h has more than k elements:
      h=[Int](h[k...])             //   Remove k elements from h
    return m                       //  Return the length of h (equal to k if l divides k)
  return n>1&&                     // Test if n > 1
  (2..<n).index{j(n, $0)>=$0}==nil //  and no number from 2 to n-1 divides n

brainfuck, 37/540 bytes (score: 0.06851) (Cracked by Nitrodon)


Try it online!

Prints "prime" if prime, "not prime" if composite. Technically works for arbitrary integers but times out on TIO for numbers above 6000