s => // s = input string g( // test if the 'sum of the letters' is prime Buffer(s).map(c => // for each ASCII code c in s: x += // increment x if ... n < ( // ... n is less than ... n += // ... the new value of n: c > 64 & // if c is greater than 64 (c &= 31) < 27 // and c mod 32 is less than 27: && c // add c mod 32 to n ), // x = n = 0 // start with x = n = 0 ) | n // end of map(); yield n ) // end of the first call to g & g(n = x) // 2nd call to g with the 'length' x s => // s = input string g( // test if the 'sum of the letters' is prime Buffer(s).map(c => // for each ASCII code c in s: x += // increment x if ... n < ( // ... n is less than ... n += // ... the new value of n: c > 64 & // if c is greater than 64 (c &= 31) < 27 // and c mod 32 is less than 27: && c // add c to n ), // x = n = 0 // start with x = n = 0 ) | n // end of map(); yield n ) // end of the first call to g & g(n = x) // 2nd call to g with the 'length' x s => // s = input string g( // test if the 'sum of the letters' is prime Buffer(s).map(c => // for each ASCII code c in s: x += // increment x if ... n < ( // ... n is less than ... n += // ... the new value of n: c > 64 & // if c is greater than 64 (c &= 31) < 27 // and c mod 32 is less than 27: && c // add c mod 32 to n ), // x = n = 0 // start with x = n = 0 ) | n // end of map(); yield n ) // end of the first call to g & g(n = x) // 2nd call to g with the 'length' x Commented
Helper function
g = k => // g is a helper function testing if n is prime n % --k ? // decrement k; if it does not divide n: g(k) // do recursive calls until it does : // else: k == 1 // test whether k = 1 Main function
s => // s = input string g( // test if the 'sum of the letters' is prime Buffer(s).map(c => // for each ASCII code c in s: x += // increment x if ... n < ( // ... n is less than ... n += // ... the new value of n: c > 64 & // if c is greater than 64 (c &= 31) < 27 // and c mod 32 is less than 27: && c // add c to n ), // x = n = 0 // start with x = n = 0 ) | n // end of map(); yield n ) // end of the first call to g & g(n = x) // 2nd call to g with the 'length' x Commented
Helper function
g = k => // g is a helper function testing if n is prime n % --k ? // decrement k; if it does not divide n: g(k) // do recursive calls until it does : // else: k == 1 // test whether k = 1 Main function
s => // s = input string g( // test if the 'sum of the letters' is prime Buffer(s).map(c => // for each ASCII code c in s: x += // increment x if ... n < ( // ... n is less than ... n += // ... the new value of n: c > 64 & // if c is greater than 64 (c &= 31) < 27 // and c mod 32 is less than 27: && c // add c to n ), // x = n = 0 // start with x = n = 0 ) | n // end of map(); yield n ) // end of the first call to g & g(n = x) // 2nd call to g with the 'length' x JavaScript (Node.js), 88 bytes
Returns 0 or 1.
s=>(g=k=>n%--k?g(k):k==1)(Buffer(s).map(c=>x+=n<(n+=c>64&(c&=31)<27&&c),x=n=0)|n)&g(n=x)