[Question]
  [
# Introduction
A pure word (or perfect word), as defined by me, is a word where the sum of the position in the alphabet of each letter in the word is perfectly divisible by the total length of the word. For example, `abcb` is a perfect word because `1 + 2 + 3 + 2 = 8`, and `8 / 4 = 2`.
# Your task
Given a word as input, output whether or not it is a perfect word. The word may always be assumed to be lowercase.
## Scoring
This is code-golf, so shortest program in bytes wins.
## Examples
```
abcb: truthy
ccc: truthy
aaa: truthy
pure: truthy
word: truthy
bed: falsy
code: falsy
bode: falsy
```
  
[Answer]
# [Factor](https://factorcode.org/), ~~37~~ 16 bytes
```
[ mean fixnum? ]
```
[Try it online!](https://tio.run/##HYoxDgIhEEV7TjHhAFtaaGFpbGyMlbEYZmeVCAOB2cT18gg27@W//AVJU2m36/ly2kNEfU1VUX1VTxXeXITDP0MurLrl4kXhycIFg//2Z5IKB2MsOnLWWCLqRMROx/MoaeYxhtodIqPA4j@yxiM82g4Ecw4bTBUoMJb2Aw "Factor – Try It Online")
Is the mean of the input an integer?
#### Why does this work?
Four reasons.
* Strings in Factor are just sequences of code points.
* Because the question is asking for a sum divided by a length. Otherwise known as the mean.
* The `mean` word returns a ratio, not a float. In Factor, ratios automatically reduce to simplified form, which can be an integer. We can check for divisibility after taking the mean by checking whether the result is an integer or a ratio.
* It doesn't matter whether the input ranges from 1-26 or 97-122. It doesn't change whether the mean is an integer or not.
[Answer]
# [Python 3](https://docs.python.org/3), 33 bytes
```
lambda s:sum(map(ord,s))%len(s)<1
```
[Try it online!](https://tio.run/##Hcg7CsMwEEXR3qt4TdAMuAnpTLySkGL0IwJrJCSnyOoV5Opwb/2dn6KPMeJ@SLZe0Lf@zZSlUml@7cy3Iyh1ft6HYsfLiHXWrDDOuYmITGzw1yw@XDl9L7E0JCSFbgtQW9KTIiXm8Qc)
[Answer]
# [R](https://www.r-project.org/), ~~42~~ ~~39~~ 33 bytes
```
function(w)!mean(utf8ToInt(w))%%1
```
[Try it online!](https://tio.run/##K/qfpmCj@z@tNC@5JDM/T6NcUzE3NTFPo7QkzSIk3zOvBCiiqapq@D9NQykxKTlJSZNTWSGEC8hLTk5GcBITExGcpNQUMMcNrCw/JRXBS4Lz/gMA "R – Try It Online")
-6 bytes thanks to m90.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
OIgÖ
```
[Try it online!](https://tio.run/##yy9OTMpM/f/f3zP98LT//6MtzXUULC2A2BJExwIA "05AB1E – Try It Online") Takes input as a list of codepoints.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jellylanguage), 5 bytes
```
OSḍ@L
```
[Try It Online!](https://jht.hyper-neutrino.xyz/tio#WyIiLCJPU+G4jUBMIiwiw4figqwiLCIiLFsiW1wiYWJjYlwiLCBcImNjY1wiLCBcImFhYVwiLCBcImJlZFwiLCBcImNvZGVcIiwgXCJib2RlXCJdIl1d)
```
OSḍ@L    Main Link
O        ord (vectorizes)
 S       sum
  ḍ@     is this divisible by
    L    the length of the input?
```
If outputting inconsistent truthy/falsy values is allowed:
# [Jelly](https://github.com/DennisMitchell/jellylanguage), 4 bytes
```
OSọL
```
[Try It Online!](https://jht.hyper-neutrino.xyz/tio#WyIiLCJPU+G7jUwiLCLDh+KCrCIsIiIsWyJbXCJhYmNiXCIsIFwiY2NjXCIsIFwiYWFhXCIsIFwiYmVkXCIsIFwiY29kZVwiLCBcImJvZGVcIl0iXV0=)
```
OSọL    Main Link
O       ord (vectorizes)
 S      sum
  ọ     how many times is this divisible by
   L    the length?
```
This works using an observation made by [caird coinheringaahing](https://chat.stackexchange.com/transcript/message/60084609) in chat that you do not need to account for the offset between A = 1 and A = 65 when you take the codepoint, since the codepoint offset will be added `len(X)` times and not affect the modulo.
Yes, caird also just straight up gave the algorithm, but to be fair, the observation was the only non-trivial part about this solution anyway.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 5 bytes
```
C∑$LḊ
```
[Try It Online!](https://vyxapedia.hyper-neutrino.xyz/tio#WyIiLCJD4oiRJEzhuIoiLCIiLCIiLCJhYmNiIl0=)
Same thing as my Jelly solution.
```
C∑$LḊ    Full Program
C        ord (vectorizes)
 ∑       sum
  $      swap; bring the string back to the top
   L     length
    Ḋ    is the ord sum divisible by the length?
```
[Answer]
# JavaScript (ES6), 58 bytes
```
w=>!([...w].reduce((s,c)=>s+parseInt(c,36)-10,0)%w.length)
```
[Answer]
# [Haskell](https://www.haskell.org/), 36 bytes
```
f w=sum(fromEnum<$>w)`mod`length w<1
```
[Try it online!](https://tio.run/##TYs9D8IgFAB3fsUbHNqkHdxpN50c3YyxD3i0RD4M0PDzsV2q211yt2B6k7W1aihDWl2jY3AXvzp@Gks7uaAmS37OCxR@rg6NH1Rg8DDdqwtP3pcQVdramfLNeGLwicbnxnQaTMtgHyoKKaAf4R5XYlLKgxHxYEFq5yvatEVB0c/Ev30B "Haskell – Try It Online")
[Answer]
# [Python](https://www.python.org), 24 bytes
```
lambda s:sum(s)%len(s)<1
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72soLIkIz9vweI025ilpSVpuhY7chJzk1ISFYqtiktzNYo1VXNS84CUjSFE-mZGQVFmXolGmkaSUmJScpKSpiYXQiQ5ORlVIDExEVUgKTUFTUt-SiqaEogIxL4FCyA0AA)
Takes input as a byte string. We don't need to subtract `95` from each element, because the sum will end up having `95 * length` added on, which has no effect on the result modulo `length`.
[Answer]
# Java, 31 bytes
```
s->s.chars().sum()%s.length()<1
```
[Try it online!](https://tio.run/##hdG9agMxDADgOfcUJhCwCzF0zs8bFAoZSwZZ9l188dmHJSeUkme/OrRday1C0ic0aIQbbEd7Xfw0p8xirLUu7IPuS0T2KeqXXTcXEzwKDEAk3sBH8dWJGr99YuCabslbMdWpPHH2cfg4C8gDqYpX79lZj8Bu/zM7iv6w0PZIGi@QSSpNZZJqQzq4OPBFqv3rsutWp09iN@lUWM91j0OUvWZHLNdg0KyV@h8hYtMAQNPMJbsmuqdsm8i4tsFk29fMH3p@4tE9lm8)
[Answer]
# [Vyxal 2.4.1](https://github.com/Vyxal/Vyxal) `K`, ~~4~~ 3 bytes
```
ṁ1Ḋ
```
[Try it Online!](https://lyxal.pythonanywhere.com?flags=K&code=%E1%B9%811%E1%B8%8A&inputs=pure&header=&footer=)
Ah yes classic pre-2.6 jank ftw. *-1 thanks to Dominic*
## Explained
```
ṁ1Ḋ
      # First, the input is converted to a list of corresponding ordinal values by the `K`(eg mode) flag:
ṁ     #   push the arithmetic mean of that list
 1Ḋ   #   is that divisible by 1? (i.e is it a whole number)
```
[Answer]
# [brainfuck](https://esolangs.org/wiki/Brainfuck), 162 bytes
```
>+[+[>+<+<]>]+[,[>[>+<<->-]<[>>>+<<<-]>>>>+<<[<+>-]<<+>>]<<]>>>[-]>>[<+>-]<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-]+++++++>[-]<[>+++++++<-]>>[<.[-]>[-]>[-]]<[-.[-]]
```
[Try It Online!](https://tio.run/##LYxdCgMxCITfexVrTyBzEfFhf1pYFtolEPb41iERojOj@da2HN9P385MiItDTCwQ4k8HnSk0zAFq08BQbsK8Oqozde5m7Iqa9b22KKpWHBi3rOC1jKIs/nQ2KC/S5iOOPh6ZV2/v@9f2Pw)
outputs `0` for **truthy** and `1` for **falsey**
This one was a lot of fun. Not necessary golf-optimal but hey, brainfuck solution :)
## Explanation
```
; 96 algorithm from esolangs constants
; initialise tape to (1)/96/0/0/0
>+[+[>+<+<]>]+[
    ; while(getchar())
    ,[>
        [>+<<->-]
        <[>>>+<<<-]>>>>+<<[<+>-]<<+>>
        ; 0/96/(0)/cumulative/length
    ]
    <<
]
; divmod algorithm from esolangs
>>>[-]>>[<+>-]
<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]
; prepare 0 for output
>[-]+++++++>[-]<[>+++++++<-]
; if(sum%length){print 1}else{print 0}
>>[<.[-]>[-]>[-]]<[-.[-]]
```
[Answer]
# Excel, ~~59~~ 54 bytes
Saved 5 bytes thanks to pajonk.
```
=MOD(SUM(CODE(MID(A1,SEQUENCE(LEN(A1)),1))),LEN(A1))=0
```
Input is in cell `A1`. Output is wherever the formula is.
* `SEQUENCE(LEN(A1))` creates an array with values 1 to the word length.
* `MID(A1,SEQUENCE(~),1)` pulls out each letter from the input one at a time.
* `CODE(MID(~))` finds the ASCII code for each letter. We don't have to convert this to 1-26 because it's 1 extra 96 for ever letter of the input so divisibility will be the same.
* `SUM(CODE(~))` adds all those values.
* `MOD(SUM(~),LEN(A1))` returns 0 if it's a whole number and a decimal if it isn't. If anything, this is the opposite of what we want because `0` is falsey and other numbers are truthy, at least in Excel.
* `MOD(~)=0` returns `TRUE` or `FALSE`.
[![Result](https://i.stack.imgur.com/jADJA.png)](https://i.stack.imgur.com/jADJA.png)
---
I found an alternative with the same byte count. It works in reverse and exploits the fact that `CODE()` only pulls the left-most character if it's given a string of greater length. I almost like it more, though, because it has 5 closing parentheses in a row.
```
=MOD(SUM(CODE(RIGHT(A1,SEQUENCE(LEN(A1))))),LEN(A1))=0
```
[Answer]
# [Julia 1.0](http://julialang.org/), 25 bytes
```
!x=sum(Int,x)%length(x)<1
```
[Try it online!](https://tio.run/##RcpLCsIwFIXheVdxWxASyKTTYJy7Crl51EbibckD0tXHFrGe0Qf/eZXgcayt9VWl8mZ3yqLyS3D0zDOr/Dq2aYkQPDnwBNGhPZwY72AfCniAgrQGn9kRBAxy@LY1esqBGIK6QY@8c2QbaqMl5FjyvHXGmNOIeFo7K2HCkPbLYt3P@u8P "Julia 1.0 – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 37 bytes
```
s=>eval(Buffer(s).join`+`)%s.length<1
```
[Try it online!](https://tio.run/##hc/LCsIwEIXhvU8RCkKCNMW9deGTdDKd9ELISCYt@PRRBF1Uxf0H/zkzrCCYpmuuI/dUfFukPdMKQV8W7ylpMXbmKXaHzuzFBopDHk/HghyFA9nAg/a6AoeuMkapplE5LXm87TYCEZ/gtwCAP8JR/xYegnxGHh9eM74CtwXlDg "JavaScript (Node.js) – Try It Online")
[Answer]
# [Scala](http://www.scala-lang.org/), 17 bytes
```
s=>s.sum%s.size<1
```
[Try it online!](https://tio.run/##ZY/BisJADIbvPsVPcaEFFfYqtqBPIHjwnJlJtVI7dTKKbOmzd4O6hdVLEr7kg/xiqabBmxPbiC2HUvveBwe@R26cYN226CaA4xKVvC6W2MVQNQfkBTbe10wN8kHyQhZyPX9prX549T2ot@NLqg1IyFiTYF4ghivPnsxa@46I6B0Zdg9UUi2j6R1/QPMPKssWpQ9M9ogOloSRykyjtZqBXabvP7xWs8S6SSWZCg7VjWWJaTemTSXrR0k3f2OSqd1P@uEX "Scala – Try It Online")
[Answer]
# [Wolfram Mathematica](https://www.wolfram.com/mathematica/), ~~34~~ 24 bytes
```
1∣Mean@LetterNumber@#&
```
-10 bytes from @att
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b73/BRx2Lf1MQ8B5/UkpLUIr/S3KTUIgdltf8BRZl5JdHKunZpDs4ZiUWJyUDZYgflWLW64OTEvLpqLqXEpOQkJR0upeTkZBCVmJgIogpKi1JBdHl@UQqITkoFU8n5KWDhJCidqMRV@x8A)
[Answer]
# APL+WIN, ~~22~~ 16 bytes
Prompts for string
```
0=(⍴s)|+/⎕av⍳s←⎕
```
[Try it online!Thanks to Dyalog Classic](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcQJanP5BlyPWooz3tv4GtxqPeLcWaNdr6QJnEske9m4uBskD2f6A81/80LvXEpOQkdS4gIzk5GUwnJiaC6aTUFIh4fkoqRADEAAA "APL (Dyalog Classic) – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~5~~ 4 bytes
*Edit: -1 byte thanks to Razetime*
```
¦L¹Σ
```
[Try it online!](https://tio.run/##yygtzv6f@6ip8f@hZT6Hdp5b/P///2ilxKTkJCUdpeTkZCCZmJgIJJNSU0Ai@SmpIA6IigUA "Husk – Try It Online")
Outputs truthy (non-zero) for perfect words, falsy (zero) for non-perfect words.
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-nl`, 17 bytes
```
p$_.sum%$_.size<1
```
[Try it online!](https://tio.run/##FcUxCoAwDAXQ/Z9DRwV37yJJmqFgm9JaRA9v1OW92vlyL8M2t57Gv3jrurgTC0NEQEQovSpOqwGsAWJBwR@PlSNabj7l/QU "Ruby – Try It Online")
[Answer]
# [BQN](https://mlochbaum.github.io/BQN/index.html), ~~16~~ ~~12~~ ~~9~~ 8 bytes
*Edit: -3 bytes thanks to ovs, and -1 byte thanks to DLosc*
```
≠|·+´@-⊢
```
[Try it at BQN online REPL](https://mlochbaum.github.io/BQN/try.html#code=RiDihpAg4omgfMK3K8K0QC3iiqIKCkbCqCDin6gicHVyZSIsIndvcmQiLCJhYmNkIuKfqQ==)
Outputs nonzero (truthy) for non-perfect words, zero (falsy) for perfect words.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Takes input as an array of characters. The `c` can be removed by instead taking input as an array of codepoints.
```
xc vUl
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=cQ&code=eGMgdlVs&input=ImFiY2Ii)
```
xc vUl     :Implicit input of array U
x          :Sum of
 c         :  Codepoints
   v       :Is divisible by
    Ul     :  Length of U
```
[Answer]
# [J](http://jsoftware.com/), 14 bytes
```
0=#|1#.96|3&u:
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DWyVawyV9SzNaozVSq3@a3JxpSZn5CsYKtgqpCmoJyYlJ6mjiCQnJ6MKJCYmQgUMIAJJqSmoAsn5KaloSkAi/wE "J – Try It Online")
*-1 thanks to south*
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 9 bytes
```
¬﹪ΣＥθ℅ιＬθ
```
[Try it online!](https://tio.run/##DcfBDYAgDADAVXi2CU7gCqImTtCAkSaVCgHXr97vYqYWlcRsb1w6rNohaBqicIwbAj1Qvdta4kICjIjeLWe5eob6B2ezcrLY9MoH "Charcoal – Try It Online") Link is to verbose version of code. Outputs a Charcoal boolean, i.e. `-` for a perfect word, nothing if not. Explanation:
```
    θ        Input string
   Ｅ         Map over characters
      ι      Current character
     ℅       Ordinal
  Σ          Sum
¬﹪           Is divisible by
        θ    Input string
       Ｌ     Length
             Implicitly print
```
[Answer]
# [SNOBOL4 (CSNOBOL4)](http://www.snobol4.org/csnobol4/), ~~103~~ 98 bytes
```
	L =SIZE(W =INPUT)
N	W LEN(1) . X REM . W :F(O)
	S =S + ORD(X)	:(N)
O	OUTPUT =1	EQ(REMDR(S,L))
END
```
[Try it online!](https://tio.run/##DcsxC8IwEIbh@fIrvvEORSg4FbLlhEK8aNKS4ljsJnbw/xMzvcv7/L7HdnyurVGEL9NLucJP9lhmcUYVUY0HwQUrst57K8YbJ3FU@o8TUg68Co1s4hKlZe4UfiB9cgchczlHEacWWtv29x8 "SNOBOL4 (CSNOBOL4) – Try It Online")
Prints `1` for truthy and nothing for falsey.
[Answer]
# [Ly](https://github.com/LyricLy/Ly), 8 bytes
```
iys&+l%!
```
[Try it online!](https://tio.run/##y6n8/z@zslhNO0dV8f//xKTkJAA "Ly – Try It Online")
```
i         - read STDIN onto stack as codepoints
 ys       - push length of the stack, save to backup cell
   &+     - sum the codepoints on the stack (1)
     l    - load the number of chars from the backup cell
      %   - module math to push "0" if evenly divisble, ">0" otherwise
       !  - negate modulo result so that 0->1 and other->0
```
(1) The code includes the length of the original stack in the sum of the codepoints to save the `p` byte that would be needed to delete it. But it doesn't change the result of the modulo math to get the final result.
When the code exits, the only thing on the stack is the `0|1` result, which is printed as a number automatically.
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 46 bytes
```
.
$&26$*
+T`1l`_3l`\D.
^
2
O^`.
3
1
^(1+)2\1*$
```
[Try it online!](https://tio.run/##DcRBCoAgEAXQ/T@HhRUIGnSCoGWblmIzTi4EMYjub73Fe9KbK7dOb9QMVO8WNWI6yBY650J@NQhw2AMZzLAI2k6D83ZUrdWUCzhKhIiAmRHTBbmvhPj3AQ "Retina 0.8.2 – Try It Online") Link includes test cases. Explanation:
```
.
$&26$*
```
Append 26 `1`s to each letter.
```
+T`1l`_3l`\D.
```
Cycle the letters through the alphabet, removing a `1` each time. Once the letter reaches `a`, replace it with a `3`. (Note that this numbers the alphabet in reverse but this doesn't affect the divisibility check.)
```
^
2
O^`.
```
Insert a `2` and then sort the digits in reverse order, so you have the `3`s for each letter, the `2`, and then the `1`s representing the sum of the positions.
```
3
1
```
Change the `3`s into `1`s.
```
^(1+)2\1*$
```
Check that the leading `1`s divide the trailing `1`s.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `Ṁ`, 11 10 bytes
-1 thanks to [Neil](https://codegolf.stackexchange.com/users/17602/neil)
```
ƛkanḟ;∑?LḊ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyLhuYAiLCIiLCLGm2thbuG4nzviiJE/TOG4iiIsIiIsImFiY2IiXQ==)
# Explanation
```
ƛkanḟ;∑?LḊ
ƛ            Start a mapping lambda for input
 ka          Lowercase alphabet
   n         Current letter
    ḟ        Find letter in the alphabet, return index
     ;       Close mapping lambda
      ∑      Sum the list of indices.
       ?L    Get Length of input
         Ḋ   Check if Sum is divisible by the length.
```
[Answer]
# [Python 3](https://docs.python.org/3/), 50 bytes
```
s=input();print(sum(ord(c)-95for c in s)%len(s)<1)
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v9g2M6@gtERD07qgKDOvRKO4NFcjvyhFI1lT19I0Lb9IIVkhM0@hWFM1JzVPo1jTxlDz/38A "Python 3 – Try It Online")
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), ~~14~~ 11 bytes
-3 bytes from @Dominic van Essen's improvement
```
{~(#x)!+/x}
```
[Try it online!](https://ngn.codeberg.page/k/#eJxFztEKwiAUxvF7n8JWFxux3KKL0EeJoKPTNrZm6YkcUc+eI6y7H5wPzt/w5ztfhmKxZuFFCPLn6jC9HTeU0iBOthf5yUA3iCAm4YrjvDlkIJXMRH2crZRKBIBEqZtMVN+BbXSyTCaMtIhXzxmb72c7mI1HUL0OqoXxrDfKXtjtrj12dvRsu6urfcU6X3ZYQnnVzmiF5cO6hsw1nKK7YzuRmPNz7Pk5BnFqYPBxEh8my78/fUBWfw==)
* `+/x` take the sum of the ASCII codes of the (strictly lowercase) input
* `(#x)!` mod this sum by the length of the input
* `~` "not" the result, i.e. return `1` if the sum is evenly divisible by the length (i.e. the mod returns 0), and `0` otherwise
]