Given a word, treat every letter as its number in English alphabet (so a
becomes 1, b
becomes 2, z
becomes 26 and so on), and check if all of them, including duplicates, are pairwise coprime.
The input is exactly one word of lowercase English letters. The output is the fact if the word is coprime: any truthy/falsey values, but only two variants of them. Standard loopholes are forbidden.
Test cases:
man
:True
day
:True
(thanks to Ørjan Johansen)led
:False
(l=12
andd=4
havegcd=4
)mana
:True
(thougha
occurs multiple times, 1 and 1 are coprimes)mom
:False
(gcd(13,13)=13)
)of
:False
(thanks to xnor; though15∤6
,gcd(15,6)=3
)a
:True
(if no pairs of letters, treat the word as coprime too)
This is a code-golf, so the shortest code in bytes wins!
0
if they are coprime and1
if not? \$\endgroup\$day: True
\$\endgroup\$of: False
to have a false example where no value is a multiple of another. \$\endgroup\$