| Bytes | Lang | Time | Link |
|---|---|---|---|
| 111 | sed 4.2.2 | 240703T085949Z | guest430 |
| 025 | Befunge93 | 240703T024227Z | Adelie |
| 028 | Perl 5 pF | 240701T155716Z | Xcali |
| 009 | Uiua | 240701T141726Z | nyxbird |
| 021 | Octave | 240624T210854Z | int 21h |
| 028 | Trilangle | 230226T223718Z | Bbrk24 |
| 073 | Go | 230623T194917Z | bigyihsu |
| 004 | Thunno 2 B | 230623T172042Z | The Thon |
| 012 | minigolf | 230416T041308Z | user1176 |
| 014 | J | 220114T224852Z | Jonah |
| 059 | Lua | 230412T114432Z | bluswimm |
| 040 | PARI/GP | 230412T112125Z | 138 Aspe |
| 005 | Stax | 230328T192342Z | emirps |
| 017 | ><> Fish | 230223T142425Z | emirps |
| 041 | Arturo | 230223T144637Z | chunes |
| 009 | GolfScript | 230217T193950Z | emirps |
| 067 | D | 230119T224410Z | The Zip |
| 067 | PHP | 230119T214401Z | dneustad |
| nan | 230119T162300Z | The Thon | |
| 010 | K ngn/k | 221008T001650Z | oeuf |
| 006 | Japt | 220114T210622Z | Shaggy |
| nan | Fig | 221008T002843Z | Seggan |
| 054 | Excel | 220114T203323Z | Engineer |
| 052 | Nim | 221005T193747Z | Michael |
| 007 | Vyxal | 220302T184302Z | Larry Ba |
| 032 | APOL | 220308T133615Z | Ginger |
| 042 | Swift | 220303T034745Z | Bbrk24 |
| 008 | BQN | 220115T223129Z | Dominic |
| 083 | C# | 220128T112528Z | B-Slam |
| 085 | Kotlin | 220128T122258Z | random p |
| 024 | Wolfram Mathematica | 220115T082739Z | theorist |
| 055 | Python 3 | 220114T223103Z | Larry Ba |
| 162 | brainfuck | 220117T101717Z | Rachit A |
| 004 | 05AB1E | 220114T225431Z | Makonede |
| 049 | C clang | 220117T145812Z | a stone |
| 003 | Vyxal 2.4.1 K | 220115T064508Z | lyxal |
| 113 | Whitespace | 220117T124716Z | Kevin Cr |
| 016 | Factor | 220114T195433Z | chunes |
| 017 | Ruby nl | 220117T101621Z | Kirill L |
| 005 | MathGolf | 220117T084918Z | Kevin Cr |
| 007 | Pyth | 220117T081512Z | hakr14 |
| 031 | Java | 220117T030111Z | Unmitiga |
| 125 | Python | 220116T205957Z | Binary19 |
| 011 | K ngn/k | 220115T173706Z | coltim |
| 031 | Zsh | 220116T001542Z | GammaFun |
| 050 | Python 3 | 220115T040510Z | DialFros |
| 017 | Scala | 220115T202412Z | cubic le |
| 010 | Vyxal Ṁ | 220114T194319Z | math sca |
| 033 | R | 220114T194520Z | Giuseppe |
| 004 | Husk | 220115T000158Z | Dominic |
| 046 | Retina 0.8.2 | 220115T100207Z | Neil |
| 033 | Python 3 | 220115T091352Z | solid.py |
| 008 | Ly | 220115T082456Z | cnamejj |
| 016 | APL+WIN | 220114T202959Z | Graham |
| 024 | Python | 220115T065252Z | pxeger |
| 037 | JavaScript Node.js | 220115T002439Z | Arnauld |
| 025 | Julia 1.0 | 220114T223148Z | MarcMush |
| 036 | Haskell | 220114T204519Z | Delfad0r |
| 098 | SNOBOL4 CSNOBOL4 | 220114T195026Z | Giuseppe |
| 058 | JavaScript ES6 | 220114T193705Z | Rydwolf |
| 009 | Charcoal | 220114T195500Z | Neil |
| 005 | Jelly | 220114T193643Z | hyper-ne |
| 005 | Vyxal | 220114T195008Z | hyper-ne |
sed 4.2.2, 111 bytes
s'.*'echo &@ s/{a..z}/a'e #append a bunch of 's/$/a's where $ is each letter
s/ /\n/g #put each on its own line
: #loop:
s'a$'a/g'm # add a '/g' to the end of a line
s''aa'g # add a 'a' to each line ending with 'a'
t #end
s!(.*)@(.*)!sed 'p\2'<<<'\1'!e #run the script we just generated (see below)
s/./a/gm #turn everything into 'a's
s/(.*)\n\1*// #unary: line2 mod line1
the script run on line 7:
sed 'p #prints the input before editing for use later
s/a/a/g #does nothing
s/b/aa/g #swap 'b' for 'aa'
s/c/aaa/g #swap 'c' for 'aaa'
s/d/aaaa/g #and so on
s/e/aaaaa/g
s/f/aaaaaa/g
s/g/aaaaaaa/g
s/h/aaaaaaaa/g
s/i/aaaaaaaaa/g
s/j/aaaaaaaaaa/g
s/k/aaaaaaaaaaa/g
s/l/aaaaaaaaaaaa/g
s/m/aaaaaaaaaaaaa/g
s/n/aaaaaaaaaaaaaa/g
s/o/aaaaaaaaaaaaaaa/g
s/p/aaaaaaaaaaaaaaaa/g
s/q/aaaaaaaaaaaaaaaaa/g
s/r/aaaaaaaaaaaaaaaaaa/g
s/s/aaaaaaaaaaaaaaaaaaa/g
s/t/aaaaaaaaaaaaaaaaaaaa/g
s/u/aaaaaaaaaaaaaaaaaaaaa/g
s/v/aaaaaaaaaaaaaaaaaaaaaa/g
s/w/aaaaaaaaaaaaaaaaaaaaaaa/g
s/x/aaaaaaaaaaaaaaaaaaaaaaaa/g
s/y/aaaaaaaaaaaaaaaaaaaaaaaaa/g
s/z/aaaaaaaaaaaaaaaaaaaaaaaaaa/g'<<<'$input'
Uiua, 9 bytes
=0◿⧻⟜/+-@`
-@` subtract '`' from each character (converting to numbers)
⟜/+ get the sum the array, while keeping the original on top
⧻ get the length of the array
◿ modulo these two values
=0 does it equal zero?
Octave, 21 bytes
@(s)~mod(mean(s*1),1)
Checks whether the mean is an integer value: multiplication by 1 is needed to convert the string to the array of char codes.
Outputs 1 (true) if the word is "pure", 0 - otherwise.
Trilangle, 28 bytes
'0|2_~<.+!>S/>i,..<.@2\)/(%S
Prints "0" if the word is pure.
Try it on the online interpreter!
Roughly equivalent to this C code:
#include <stdio.h>
int main() {
int total = 0, len = 0;
int c;
while ((c = getchar()) != EOF) {
total += c;
++len;
}
if (total % len == 0) puts("0");
}
The code unfolds to this triangle:
'
0 |
2 _ ~
< . + !
> S / > i
, . . < . @
2 \ ) / ( % S
Control flow starts at the north corner heading southwest, on the red path:
'0: push a zero to the stack2: duplicate the top of the stack, so it now contains two zeroes<: redirect control flowi: read a single character in and push it to the stack>: branch
If EOF was read, control flow continues on the blue path; otherwise, control flow continues on the green path.
The green path performs the necessary additions before looping:
+: add the top two values on the stack_: redirect control flow.: no-opS: swap the top two values in the stack.: no-op\: redirect control flow): increment the top of the stack/: redirect control flow.: no-op againS: swap the values back<: redirect control flow, merging with the red path
On the blue path (after EOF is read), the following instructions are seen:
<: redirect control flow..: more no-ops,: pop the EOF off the stackS: swap the two values on the top of the stack%: pop two values off the stack and pusha % b(: decrement the top of the stack/: redirect control flow2: duplicate the top of the stack.: another no-op/: redirect control flowS: "swap" the two values in the stack (effectively a no-op, since they're the same value)>: branch
If the word is pure, the stack contains two -1's, and the interpreter takes the magenta path. If the word is not pure, the stack contains two copies of some non-negative number, and the interpreter takes the yellow path.
On the magenta path, it prints a 0 before exiting:
,: pop a value off the top of the stack2: duplicate the top of the stack (not necessary on this code path, but harmless)|: redirect control flow~: bitwise complement, changes -1 to 0!: print the top of the stack as a decimal integeri: attempt to read more input (always sees EOF)@: end program
The yellow path has a rather convoluted no-op before it exits:
\: no-op when traversed in this direction,: pop from the stack2: duplicate the value on the stack (cancels out the,)S: "swap" the two identical values@: end program.
Go, 73 bytes
func(R[]rune)bool{s:=0
for _,r:=range R{s+=int(r-'`')}
return s%len(R)<1}
Thunno 2 B, 4 bytes
SslḊ
Explanation
SslḊ # Implicit input, converted
# to ordinals by B flag
S # Sum the ordinals
sl # Get the length of the input
Ḋ # Is divisible?
# Implicit output
minigolf, 12 bytes
i+,ni#*i+=;+
Explanation
i+ sum of codepoints of input
, map in [1..sum(i)]:
n push curr. item
i#* Multiply by input's length
i+= Is that equal to input's sum?
; end map
+ Sum the list
(we definitely have a 1 output for an integer quotient,
and 0 with no integer output
Implicit output
Lua, 67 59 bytes
s=...a=0s:gsub('.',load'a=a+(...):byte()-96')print(a%#s==0)
Ungolfed version:
s=...
a=0
s:gsub('.',load'a=a+(...):byte()-96') -- Add up value of chars, store in a
print(a%#s==0)
Stax, 5 bytes
:VR1=
This program's length is the same packed and unpacked, so I chose to use the unpacked version.
Explanation
:V # mean of array (returns a fraction)
R # denominator
= # is equal to
1 # 1
><> (Fish), 26 24 23 20 19 17 bytes
l&v
v+>l1-?!
>&%n
Exits with error, which is allowed by default.
This is my first answer in this language, so it can probably be golfed.
Input is assumed to be on the stack. Output is any non-zero number for falsy, 0 for truthy.
GolfScript, 9 bytes
.{+}*\,%!
Explanation
.{+}*\,%! | whole program
{+}* | sum the codepoints of the string
. \, | push the length
% | modulo
! | logical negate
D, 67 bytes
import std;int p(string w){return !(w.fold!"a+=b-96"(0)%w.length);}
ungolfed
import std;
int p(string w) {
return !(w.fold!"a+=b-96"(0)%w.length);
}
// not much more readable, lol
takes a string w, and then performs a fold on it. The fold adds each char, minus 96, to the accumulator. 96 being the ascii value of the backtick character, one behind a (since this challenge specifies that the characters are 1-indexed). this effectively adds up all characters in the string. Then we perform a modulo for a divisibility check, and since we want 0 to be the true case, we invert it. Note how we return int from this function so that it takes up one less byte. ints can be implicitly cast to bool so it's fine.
PHP, 67 bytes
fn($w)=>!(array_sum(array_map('ord',str_split($w)))%96%strlen($w));
Ungolfed
fn($w) => !(array_sum(
array_map('ord', str_split($w))
) % 96 % strlen($w));
Thunno, \$ 7\log_{256}(96)\approx \$ 5.76 bytes
OSz0L%!
Explanation
OSz0L%! # Implicit input
S # the sum of
O # the ords of the input
%! # is divisible by
L # the length of
z0 # the input?
# Implicit output
K (ngn/k), 11 10 bytes
{(#x)!+/x}
Saves a byte by not using the Not operator (~)
Quick and simple. Return 0 for true and any other value for false.
Explanation:
{(#x)!+/x} Main function. Takes x as input
+/x Sum of all charcodes in x
! Modulo
(#x) Length of x
Japt, 6 bytes
Takes input as an array of characters. The c can be removed by instead taking input as an array of codepoints.
xc vUl
xc vUl :Implicit input of array U
x :Sum of
c : Codepoints
v :Is divisible by
Ul : Length of U
Fig, \$4\log_{256}(96)\approx\$ 3.292 bytes
%LxS
Port of K answer. Prints 0 for truthy and a positive number for falsey.
%LxS
S # Sum of charcodes
% # Modulo
Lx # Length of input
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 because0is falsey and other numbers are truthy, at least in Excel.MOD(~)=0returnsTRUEorFALSE.
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
APOL, 32 bytes
v(0 i);!(%(⊕(ƒ(⁰ ⌕(ⓛ ∋))) l(⁰)))
Explanation:
v( Set memory cell
0
i to input
);
!( Not
%( Modulo
⊕( Sum
ƒ( List-builder for
⁰ Memory cell 0
⌕( Find
ⓛ All ASCII lowercase characters
∋ Loop item
)
)
)
l( Length of
⁰ Memory cell 0
)
)
)
Swift, 42 bytes
{$0.utf8.reduce(0){$0+Int($1)}%$0.count<1}
This uses the same algorithm as the current top answers for Python, Excel, Java, and Scala, and probably others. As for why I use .utf8, see my explanation here. As with that answer, the input type here can be String or Substring, and the output type is Bool.
It still surprises me that Swift has .reduce(0, +) rather than .sum() for collections of numbers.
BQN, 16 12 9 8 bytes
Edit: -3 bytes thanks to ovs, and -1 byte thanks to DLosc
≠|·+´@-⊢
Outputs nonzero (truthy) for non-perfect words, zero (falsy) for perfect words.
C#, 101 83 bytes
bool P(string w){int i=0;foreach(var c in w){i+=(int)c%32;};return i%w.Length==0;};
Kotlin, 85 bytes
fun i(s:String):Int{var a=0;for(i in s)a+=i.code-96;return if(a%s.length==0)1 else 0}
Ungolfed version:
fun isPure(s: String) : Int
{
var acc = 0
for(i in s) acc+= i.code-96
return if(acc%s.length==0) 1 else 0
}
1 stands for Truthy and 0 stands for falsy, derived from this post Interpretation of Truthy/Falsey
brainfuck, 162 bytes
>+[+[>+<+<]>]+[,[>[>+<<->-]<[>>>+<<<-]>>>>+<<[<+>-]<<+>>]<<]>>>[-]>>[<+>-]<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-]+++++++>[-]<[>+++++++<-]>>[<.[-]>[-]>[-]]<[-.[-]]
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}
>>[<.[-]>[-]>[-]]<[-.[-]]
C (clang), 49 bytes
i,l;f(*a){for(i=l=0;*a;i+=*a++)l++;return!(i%l);}
Takes input as a wide string; returns 1 for pure words and 0 for others.
Vyxal 2.4.1 K, 4 3 bytes
ṁ1Ḋ
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)
Whitespace, 113 bytes
[S S S N
_Push_0][S N
S _Duplicate_0][S N
S _Duplicate_0][N
S S N
_Create_Label_LOOP][S N
S _Duplicate][S N
S _Duplicate][T N
T S _Read_STDIN_as_char][T T T _Retrieve_input][S N
S _Duplicate][S S S T S T S N
_Push_10][T S S T _Subtract][N
T S S N
_If_0_jump_to_Label_PRINT_RESULT][T S S S _Add][S N
T _Swap_top_two][S S S T N
_Push_1][T S S S _Add][S N
T _Swap_top_two][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_PRINT_RESULT][S N
N
_Discard_top][S N
T _Swap_top_two][T S T T _Modulo][N
T S T N
_If_0_Jump_to_Label_TRUTHY][S S T T N
_Push_-1][N
S S T N
_Create_Label_TRUTHY][S S S T N
_Push_1][T S S S _Add][T N
S T _Print_as_integer]
Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Since Whitespace can only read input one character at a time, the input must contain a trailing newline so we'll know when we're done reading characters.
Whitespace also lacks truthy/falsey values, so this program will output 1 for truthy and 0 for falsey (could be 28 bytes less with 0 as truthy and a positive integer as falsey).
Try it online (with raw spaces, tabs and new-lines only).
Explanation in pseudo-code:
Integer length = 0
Integer sum = 0
Start LOOP:
Integer input = STDIN as character
If(input == '\n'):
Jump to PRINT_RESULT
sum = sum + input
length = length + 1
Go to next iteration of LOOP
PRINT_RESULT:
Integer result = 0
Integer mod = sum modulo length
If(mod == 0):
Skip to TRUTHY
Else:
result = -1
TRUTHY:
result = result + 1
Print result as integer to STDOUT
Factor, 37 16 bytes
[ mean fixnum? ]
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
meanword 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.
MathGolf, 5 bytes
$Σ\£÷
Input as a list of characters. Could be 1 byte less by taking the input as a list of codepoints.
Explanation:
$ # Map each character in the (implicit) input-list to a codepoint integer
Σ # Sum this list
\ # Swap so the (implicit) input-list is at the top again
£ # Pop and push its length
÷ # Check if the earlier sum is divisible by this length
# (after which the entire stack is output implicitly as result)
Pyth, 7 bytes
!%sCMQl
Explanation:
!%sCMQl | Full code
!%sCMQlQ | with implicit variables filled
---------+-------------------------------------------------------
CMQ | Replace each character in the input with its codepoint
s | Sum the resulting list
% lQ | Mod the sum with the length of the input
! | Boolean negate (i.e. 0 -> True, other -> False)
Python, 125 bytes
Wow I feel like an idiot after reading all these other amazing answers.
j=[ord(k)-96 for k in str(input(""))]
l=len(j)
while len(j)>1:j[0]+=j[1];del j[1]
print("%sy"%("truth"if j[0]%l<1else"fals"))
I think how this works is pretty trivial.
K (ngn/k), 14 11 bytes
-3 bytes from @Dominic van Essen's improvement
{~(#x)!+/x}
+/xtake 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. return1if the sum is evenly divisible by the length (i.e. the mod returns 0), and0otherwise
Zsh, 31 bytes
a=(+\#\#${(s::)^1})
(((a)%$#1))
In Zsh, ##x in arithmetic mode returns the codepoint of 'x'.
${(s::) 1} # split $1 into characters
+\#\#${(s::)^1} # append `+##` to each element
a=(+\#\#${(s::)^1}) # save as $a
(((a)%$#1)) # join $a on spaces, evaluate (+##a +##b ...) % $#1
# arithmetically
Vyxal Ṁ, 11 10 bytes
-1 thanks to Neil
ƛkanḟ;∑?LḊ
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.
Husk, 5 4 bytes
Edit: -1 byte thanks to Razetime
¦L¹Σ
Outputs truthy (non-zero) for perfect words, falsy (zero) for non-perfect words.
Retina 0.8.2, 46 bytes
.
$&26$*
+T`1l`_3l`\D.
^
2
O^`.
3
1
^(1+)2\1*$
Try it online! Link includes test cases. Explanation:
.
$&26$*
Append 26 1s 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 3s for each letter, the 2, and then the 1s representing the sum of the positions.
3
1
Change the 3s into 1s.
^(1+)2\1*$
Check that the leading 1s divide the trailing 1s.
Ly, 8 bytes
iys&+l%!
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.
Python, 24 bytes
lambda s:sum(s)%len(s)<1
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.
SNOBOL4 (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
Prints 1 for truthy and nothing for falsey.
JavaScript (ES6), 58 bytes
w=>!([...w].reduce((s,c)=>s+parseInt(c,36)-10,0)%w.length)
Charcoal, 9 bytes
¬﹪ΣEθ℅ιLθ
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
E Map over characters
ι Current character
℅ Ordinal
Σ Sum
¬﹪ Is divisible by
θ Input string
L Length
Implicitly print
Jelly, 5 bytes
OSḍ@L
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, 4 bytes
OSọL
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 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.
Vyxal, 5 bytes
C∑$LḊ
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?

