text:
Remove ambiguous plural(s)!
Programming is very rigid. You can't tell a program to "output the banana count", you have to tell it to print(bananas).
But when you do that, you end up with a problem: you don't know how many bananas you have beforehand, so you don't know whether to use a plural.
Sometimes, programmers go the lazy way. Instead of checking, they just print there are X banana(s).
But that's ugly, so we need a program to fix this.
The method(s)
To remove the ambiguous plurals in a string, follow the following steps:

Split the string on spaces into a list of words.
For every word that ends with (s), do the following:

If the preceding word is a, an, 1 or one, remove the (s) at the end of the word.
Otherwise, if the word is the first word in the string or the preceding word is not a, an, 1 or one, replace the (s) at the end of the word with s.

Join the list of words back together into a string, preserving the original whitespace.

Example(s)
Let's take a string there's a banana(s) and three apple(s).
First, we split the string into a list of words: ["there's", "a", "banana(s)", "and", "three", "apple(s)"]
For the second step, we take the two words ending with (s): banana(s) and apple(s).
The word before banana(s) is a, so we remove the (s), making it banana.
The word before apple(s) is three, so we change the (s) to s, thus it becomes apples.
We now have ["there's", "a", "banana", "and", "three", "apples"]. Joining the list back together, we get there's a banana and three apples. This is our end result.
The challenge(s)
Create a program or function that takes an ambiguous string in any reasonable format and returns the un-ambiguated version of that string.
You may assume the string contains no newlines, tabs or carriage returns.
I forgot to specify whether to split on groups of spaces or spaces (i.e. whether okay then with two spaces should be ["okay", "then"] or ["okay", "", "then"]) when posting the challenge, so you may assume either form of splitting.
Test case(s)
Input                                         -> Output
there are two banana(s) and one leprechaun(s) -> there are two bananas and one leprechaun
there's a banana(s) and three apple(s)        -> there's a banana and three apples
apple(s)                                      -> apples
one apple(s)                                  -> one apple
1 banana(s)                                   -> 1 banana
banana                                        -> banana
preserve    original      whitespace(s)       -> preserve    original      whitespaces
11 banana(s)                                  -> 11 bananas
an apple(s)                                   -> an apple
this is a te(s)t                              -> this is a te(s)t
I am a (s)tranger(s)                          -> I am a (s)tranger

Scoring
As this is code-golf, the submission with the least bytes wins!

This question has been sandboxed.

Should the apple(s) test case yield apples instead? The challenge states Otherwise, if the word is the first word in the string . . . replace the (s) at the end of the word with s. I note that this case yielded apples in sandbox for the first three revisions but changed at the fourth.

@fireflame241 When writing the second draft of the rules, I was going to make it so that the start of the string is unchanged. I changed that rule later, but not the test case. Good catch.

Test case suggestion: There's a single banana(s) -> There's a single bananas.

May we assume "words" do not contain parentheses? (i.e. the likes of  I am a (s)tranger(s) or This is a te(s)t wont be inputs)

@JonathanAllan You cannot. I'll add a few test cases.

With the newest edit, may we not preserve whitespace? (resultant from splitting on groups of spaces).

@fireflame241 The newest edit means that a  banana(s) with two spaces can become a banana with two spaces or a bananas with two spaces. You still must preserve whitespace.

This is a te(s)t would still be a useful test case, as it's subtly different from I am a (s)tranger(s).

thirty-one apple(s) should produce thirty-one apple, right?

@Ezenhis It should produce thirty-one apples. The word preceding apple(s) is thirty-one, not one.

Mathematica, 151 148 bytes
StringReplace[j=" ";k=Except@j;j<>j<>#<>j,j~~a:k...~~s:j..~~w:k..~~"(s)"~~j:>{j,a,s,w,If[FreeQ[a,"a"|"an"|"1"|"one"],"s",""]}<>j]~StringTake~{3,-2}&

Explanation
j=" ";k=Except@j

Set j to a whitespace character(s). Set k to the pattern "not j" (= non-whitespace character).
j<>j<>#<>j

Prepend two whitespace(s) and append one whitespace(s) to the input.
j~~a:k...~~s:j..~~w:k..~~"(s)"~~j

For a substring(s) matching the pattern:

One whitespace(s), followed by
a length-zero or longer substring consisting of only non-whitespace character(s) (quantifier) (call this a), followed by
a length-one or longer substring consisting of only whitespace character(s) (call this s), followed by
a length-one or longer substring consisting of only non-whitespace character(s) (word) (call this w), followed by
the string "(s)", followed by
a whitespace(s)

If[FreeQ[a,"a"|"an"|"1"|"one"],"s",""]

If a is not one of the singular word(s), evaluate to "s", otherwise "".
StringReplace[..., ... :>{j,a,s,w,If[FreeQ[a,"a"|"an"|"1"|"one"],"s",""]}<>j]

Replace the matching pattern with j, a, s, w, If[FreeQ[a,"a"|"an"|"1"|"one"],"s",""], and j joined together.
... ~StringTake~{3,-2}

Take from position 3 to position -2 (1-indexed; negative indices count from the end). This is because we added three space(s) in the beginning.

Why not use the builtin for removing plural-S?

Python 3, 94 bytes
lambda s,r=re.sub:r(r"\(s\)( |$)","s",r(r"\b(an?|1|one)(\s+)(.+)\(s\)",r"\1\2\3",s))
import re

Try it online!
-4 bytes thanks to i cri everytim (I think this is acceptable)

@JonathanAllan Fixed, thanks.

__import__ can't possibly be shorter... Yup, it's 4 bytes shorter as a regular import re.

@icrieverytim huh you're right (only 3 bytes though) thanks

wait no here's 94

@icrieverytim ._. oh nice. thanks!

wait no that's 96

wait can you assume imports before an anon lambda? I would've done that otherwise

I'm pretty sure, considering how Java and C# function submissions count import statements. I don't have a meta source though.

Mathematica, 313 bytes
(Table[If[StringLength@z[[i]]>3&&StringTake[z[[i]],-3]=="(s)",z[[i]]=StringDrop[z[[i]],-3];t=1;While[z[[i-t]]=="",t++];If[FreeQ[{"a","an","1","one"},z[[i-t]]],z[[i]]=z[[i]]<>"s"]],{i,2,Length[z=StringSplit[#," "]]}];If[StringTake[z[[1]],-3]=="(s)",z[[1]]=StringDrop[z[[1]],-3];z[[1]]=z[[1]]<>"s"];StringRiffle@z)&

Retina, 53 bytes
(( |^)(a|an|1|one) [^ ]*)\(s\)( |$)
$1
\(s\)( |$)
s$1

Try it online!

This deletes the space after banana(s) in there's a banana(s) and three apple(s) - try this fix

You can change a|an to an? for -1 byte

Perl 5, 43 + 1 (-p) = 44 bytes
s/\b((one|1|an?) +)?\S+\K\(s\)\B/"s"x!$1/ge

Match every (s) at end of word, replace it with !$1 (1 or 0) esses.

Java (OpenJDK 8), 91 83 96 bytes
s->s.replaceAll("((^| )(an?|1|one) +\\S+)\\(s\\)(?= |$)","$1").replaceAll("\\(s\\)(?= |$)","s");

Try it online!

Pyth - 53 bytes
Follows the algorithm pretty much as it is.
K+kczdjdt.e?q"(s)"gb_2+<b_3*\s!}@Ktk[\a"an""one"\1)bK

Try it online here.

Fails on there are two banana(s) and one  leprechaun(s) (two spaces after the one). The original whitespace is preserved, but leprechaun(s) ignores the one before it.

@LyricLy you have not explicitly stated this in the OP. With two spaces (using (1) of your "method(s)" section of "split  the string on spaces into a list of words") there is actually an empty word between one and leprechaun(s)

Jelly,  52 51  49 bytes
Jelly has not got one regex(s) atom
Ṫ
Ñ;”s
Ṫḣ-3
UṪw“)s(”⁼1
“µḣ⁴µuʠg*»ḲċḢ‘×Ç‘
⁶;ḲÇĿ2ƤK

A full program accepting a string (using Python formatting if multiline or containing quotes) and printing the output.
Try it online! or see the test-suite.
How?
Ṫ - Link 1, tail: two words (list of lists)
Ṫ - tail

Ñ;”s - Link 2, tail and replace last three chars with an 's': two words (list of lists)
Ñ    - call the next link (3) as a monad
  ”s - literal 's'
 ;   - concatenate

Ṫḣ-3 - Link 3, tail and remove the last three chars: two words (list of lists)
Ṫ    - tail
  -3 - literal minus three
 ḣ   - head from index (1-indexed and modular)

UṪw“)s(”⁼1 - Link 4, tail ends with "(s)"?: two words (list of lists)
U          - upend (reverse each word)
 Ṫ         - tail
   “)s(”   - literal [')', 's', '('] - that is "(s)" reversed
  w        - index of first sublist equal to that or 0 if not found
         1 - literal one
        ⁼  - equal?

“µḣ⁴µuʠg*»ḲċḢ‘×Ç‘ - Link 5, categorise: two words (list of lists)
“µḣ⁴µuʠg*»        - compression of string "a 1" + word " an" + word " one"
          Ḳ       - split on spaces = ["a", "1", "an", "one"]
            Ḣ     - head (the first word)
           ċ      - count occurrences (of head in the list - either 0 or 1)
             ‘    - increment
               Ç  - call the last link (4) as a monad - i.e. f(two words)
              ×   - multiply
                ‘ - increment - so we have: 1 for ["1", "blah"],
                  -             2 for ["blah", "blah(s)"] or 3 for ["1", "blah(s)"]

⁶;ḲÇĿ2ƤK - Main link: list of characters, the string
⁶        - literal space character
 ;       - concatenate (place a space at the beginning as we want to inspect pairs)
  Ḳ      - split on spaces (giving an empty list at the start)
     2Ƥ  - for all infixes of length two:
    Ŀ    -   call the link at the given index as a monad:
   Ç     -     call the last link (5) as a monad
       K - join the result with spaces
         - implicit print

I'm curious as to why you used Ṫ as a separate link. Does this prevent Ṫ from deleting the element from the original list?

No, I need to get the tail of the pair... writing up a code commentary, maybe you can spot a golf once you see that.

Ah okay. Thanks, I'll try to spot the golf once there's a commentary (or before then)!

So links 1, 2 and 3 all tail, and link 5 chooses which to call and uses Ŀ to do so, but I don't see a short way to tail inside link 4, but there might be. There could even be a way to get the tail of link 4 in there too!

@HyperNeutrino I think that the Ŀ thingy may call the first link, that's why Ṫ is a link on its own.

Perl 5, 56 + 1 (-p) = 57 bytes
s/\b(an?|1|one) +\S+\K\(s\)(?= |$)//g;s/\(s\)( |$)/s$1/g

Try it online!

Not on the test cases, but I think this fails for a hel(s)lo.

That's working properly as provided in the test case.  It's near the bottom of the test cases in my TIO link.

Well I'll just have to get a hel(s)lo added to the test cases, and then maybe you'll fix your code...

JavaScript (ES6), 88 87 bytes
a=>a.replace(/(\S+)( +)(\S+)\(s\)/g,(m,f,s,w)=>f+s+w+(/^(a|an|1|one)$/.exec(f)?'':'s'))

Explanation coming soon.

you can replace \s with   according to "You may assume the string contains no newlines, tabs or carriage returns."

Fails on "this is a te(s)t". You can fix by adding (\s|$) to the end of the regex.

Also fails on "apple(s)". Fixed in this TIO

Thanks @Birjolaxew, will edit in the changes when I can...

JavaScript (ES6), 84 bytes
s=>s.replace(/((^|\S+ +)\S+)\(s\)(?!\S)/g,(_,a)=>a+(/^(1|an?|one) /.test(a)?'':'s'))

Here's an interesting way to rearrange the last part, which is sadly 2 bytes longer:
s=>s.replace(/((^|\S+ +)\S+)\(s\)(?!\S)/g,(_,a)=>a+'s'.slice(/^(1|an?|one) /.test(a)))

JavaScript (SpiderMonkey), 82 bytes
s=s.replace(/(\S+ +(\S+))\(s\)\B/g,(_,a)=>a+("s"[+/^(1|one|an?)\b/i.test(a)]||""))

Try it online!
78 Byte version (less robust)
s=s.replace(/(\S+ +(\S*))\(s\)/g,(_,a)=>a+("s"[+/^(1|one|an?)/i.test(a)]||""))

This is a modified version of ETHproductions' (I don't have 50 rep.)
Explanation

/(\S+ +(\S+))\(s\)/g - the actual pattern to look for (amount object(s))
(_,a)=>a - _ is a catch all variable, a is the (\S+ +(\S+))
"s"[+/^(1|one|an?)/i.test(a)]||"" - instead of slicing the array, just make a dummy array and get the index (+/.../.test returns a number)

should "s"[+/^(1|one|an?)/i.test(a)] return undefined (true, or 1 for the test) return ""

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Frequency Distribution of Multiple Dice Rolls
Given two positive integers a and b, output the frequency distribution of rolling a b-sided die a times and summing the results.
A frequency distribution lists the frequency of each possible sum if each possible sequence of dice rolls occurs once. Thus, the frequencies are integers whose sum equals b**a.
Rules

The frequencies must be listed in increasing order of the sum to which the frequency corresponds.
Labeling the frequencies with the corresponding sums is allowed, but not required (since the sums can be inferred from the required order).
You do not have to handle inputs where the output exceeds the representable range of integers for your language.
Leading or trailing zeroes are not permitted. Only positive frequencies should appear in the output.

Test Cases
Format: a b: output
1 6: [1, 1, 1, 1, 1, 1]
2 6: [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]
3 6: [1, 3, 6, 10, 15, 21, 25, 27, 27, 25, 21, 15, 10, 6, 3, 1]
5 2: [1, 5, 10, 10, 5, 1]
6 4: [1, 6, 21, 56, 120, 216, 336, 456, 546, 580, 546, 456, 336, 216, 120, 56, 21, 6, 1]
10 10: [1, 10, 55, 220, 715, 2002, 5005, 11440, 24310, 48620, 92368, 167860, 293380, 495220, 810040, 1287484, 1992925, 3010150, 4443725, 6420700, 9091270, 12628000, 17223250, 23084500, 30427375, 39466306, 50402935, 63412580, 78629320, 96130540, 115921972, 137924380, 161963065, 187761310, 214938745, 243015388, 271421810, 299515480, 326602870, 351966340, 374894389, 394713550, 410820025, 422709100, 430000450, 432457640, 430000450, 422709100, 410820025, 394713550, 374894389, 351966340, 326602870, 299515480, 271421810, 243015388, 214938745, 187761310, 161963065, 137924380, 115921972, 96130540, 78629320, 63412580, 50402935, 39466306, 30427375, 23084500, 17223250, 12628000, 9091270, 6420700, 4443725, 3010150, 1992925, 1287484, 810040, 495220, 293380, 167860, 92368, 48620, 24310, 11440, 5005, 2002, 715, 220, 55, 10, 1]
5 50: [1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315, 8855, 10626, 12650, 14950, 17550, 20475, 23751, 27405, 31465, 35960, 40920, 46376, 52360, 58905, 66045, 73815, 82251, 91390, 101270, 111930, 123410, 135751, 148995, 163185, 178365, 194580, 211876, 230300, 249900, 270725, 292825, 316246, 341030, 367215, 394835, 423920, 454496, 486585, 520205, 555370, 592090, 630371, 670215, 711620, 754580, 799085, 845121, 892670, 941710, 992215, 1044155, 1097496, 1152200, 1208225, 1265525, 1324050, 1383746, 1444555, 1506415, 1569260, 1633020, 1697621, 1762985, 1829030, 1895670, 1962815, 2030371, 2098240, 2166320, 2234505, 2302685, 2370746, 2438570, 2506035, 2573015, 2639380, 2704996, 2769725, 2833425, 2895950, 2957150, 3016881, 3075005, 3131390, 3185910, 3238445, 3288881, 3337110, 3383030, 3426545, 3467565, 3506006, 3541790, 3574845, 3605105, 3632510, 3657006, 3678545, 3697085, 3712590, 3725030, 3734381, 3740625, 3743750, 3743750, 3740625, 3734381, 3725030, 3712590, 3697085, 3678545, 3657006, 3632510, 3605105, 3574845, 3541790, 3506006, 3467565, 3426545, 3383030, 3337110, 3288881, 3238445, 3185910, 3131390, 3075005, 3016881, 2957150, 2895950, 2833425, 2769725, 2704996, 2639380, 2573015, 2506035, 2438570, 2370746, 2302685, 2234505, 2166320, 2098240, 2030371, 1962815, 1895670, 1829030, 1762985, 1697621, 1633020, 1569260, 1506415, 1444555, 1383746, 1324050, 1265525, 1208225, 1152200, 1097496, 1044155, 992215, 941710, 892670, 845121, 799085, 754580, 711620, 670215, 630371, 592090, 555370, 520205, 486585, 454496, 423920, 394835, 367215, 341030, 316246, 292825, 270725, 249900, 230300, 211876, 194580, 178365, 163185, 148995, 135751, 123410, 111930, 101270, 91390, 82251, 73815, 66045, 58905, 52360, 46376, 40920, 35960, 31465, 27405, 23751, 20475, 17550, 14950, 12650, 10626, 8855, 7315, 5985, 4845, 3876, 3060, 2380, 1820, 1365, 1001, 715, 495, 330, 210, 126, 70, 35, 15, 5, 1]

Can we assume that b is at least 2? (Or if not, what should the frequency list for sums of a 1-sided die look like?)

May we have leading or trailing zeroes?

Octave, 38 bytes
@(a,b)round(ifft(fft((a:a*b<a+b)).^a))

Try it online!
Explanation
Adding independent random variables corresponds to convolving their probability mass functions (PMF), or multiplying their characteristic functions (CF). Thus the CF of the sum of a independent, identically distributed variables is given by that of a single variable raised to the power of a.
The CF is essentially the Fourier transform of the PMF, and can thus be computed via a FFT. The PMF of a single b-sided die is uniform on 1, 2, ..., b. However, two modifications are required:

1 is used instead of the actual probability values (1/b). This way the result will be de-normalized and will contain integers as required.
Padding with zeros is needed so that the FFT output has the appropriate size (a*b-a+1) and the implicit periodic behaviour assumed by the FFT doesn't affect the results.

Once the characteristic function of the sum has been obtained, an inverse FFT is used to compute the final result, and rounding is applied to correct for floating-point inaccuracies.
Example
Consider inputs a=2, b=6. The code a:a*b<a+b builds a vector with b=6 ones, zero-padded to size a*b-a+1:
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]

Then fft(...) gives
[36, -11.8-3.48i, 0.228+0.147i, -0.949-1.09i, 0.147+0.321i, -0.083-0.577i, -0.083+0.577i, 0.147-0.321i, -0.949+1.09i, 0.228-0.147i, -11.8+3.48i]

One can almost recognize the sinc function here (Fourier transform of a rectangular pulse).
(...).^a raises each entry to a and then ifft(...) takes the inverse FFT, which gives
[1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]

Although the results in this case are exactly integers, in general there may be relative errors of the order of 1e-16, which is why round(...) is needed.

I really Impressed!

@rahnema1 Signal processing for the win!

Mathematica, 29 bytes
Tally[Tr/@Range@#2~Tuples~#]&

Just generates all possible dice rolls, takes their totals, then counts. Each frequency comes labeled with its value.
Mathematica, 38 bytes
CoefficientList[((x^#2-1)/(x-1))^#,x]&

Expands (1+x+x^2+...+x^(a-1))^b and takes the coefficients of x. Since 1+x+x^2+...+x^(a-1) is the generating function for a single die roll and products correspond to convolutions - adding values of dice - the result gives the frequency distribution.

Haskell, 90 79 77 75 bytes
Thanks to Lynn for the Cartesian product trick. -11 bytes thanks to many Haskell tricks from Funky Computer Man, -2 bytes from naming, -2 bytes thanks to Laikoni. Golfing suggestions are welcome! Try it online!
import Data.List
g x=[1..x]
a!b=map length$group$sort$map sum$mapM g$b<$g a

Ungolfed
import Data.List
rangeX x = [1..x]
-- sums of all the rolls of b a-sided dice
diceRolls a b = [sum y | y <- mapM rangeX $ fmap (const b) [1..a]]
-- our dice distribution
distrib a b = [length x | x <- group(sort(diceRolls a b))]

Use $ instead of () to save 2 bytes. TIO

And don't use replicate

And use maps instead of comprehensions

You can also predefine your lambda

(map length$)=(length<$>) for two bytes

@MichaelKlein I tried d a b=length<$>group$sort$map sum$mapM g$g a>>[b] with d 3 6 is returning only 16. Any idea why?

I think you can use b<$g a instead of g a>>[b].

R, 58 bytes
function(a,b)table(rowSums(expand.grid(rep(list(1:b),a))))

Try it online!

Pyth - 10 bytes
Just takes all possible dice combinations by taking the cartesian product of [1, b], a times, summing, and getting the length of each sum group.
lM.gksM^SE

Test Suite.

05AB1E, 8 bytes
LIãO{γ€g

Try it online!
How?

LIãO{γ€g  - Full program.

L         - Range [1 ... input #1]
 I        - Input #2.
  ã       - Cartesian Power.
   O      - Map with sum.
    {     - Sort.
     γ    - Group consecutive equal elements.
      €g  - Get the length of each

R, 52 bytes
function(a,b)Re(fft(fft(a:(a*b)<a+b)^a,T)/(a*b-a+1))

Try it online!
A port of @Luis Mendo's Octave solution, fft(z, inverse=T) unfortunately returns the unnormalized inverse FFT, so we have to divide by the length, and it returns a complex vector, so we take only the real part.

well played - payback for yesterday's cmdscale I figure :-)

@flodel hah! I'm actually going to award you a bounty for that one :)

You were not joking! So generous of you! I enjoy seeing (and learning from) your answers, I will pay it back quickly!

Jelly, 5 bytes
ṗS€ĠẈ

Try it online!
Note that this takes the arguments in reverse order.
How?

ṗS€ĠL€   - Full program (dyadic) | Example: 6, 2

ṗ        - Cartesian Power (with implicit range) | [[1, 1], [1, 2], ... , [6, 6]]
 S€      - Sum each | [2, 3, 4, ... , 12]
   Ġ     - Group indices by values | [[1], [2, 7], [3, 8, 13], ... , [36]]
    L€   - Length of each group | [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]

Alternative solutions:
ṗZSĠL€
ṗZSµLƙ
ṗS€µLƙ

SageMath, 40 bytes
lambda a,b:reduce(convolution,[[1]*b]*a)

Try it online
convolution computes the discrete convolution of two lists. reduce does what it says on the tin. [1]*b is a list of b 1s, the frequency distribution of 1db. [[1]*b]*a makes a nested list of a copies of b 1s.

Python 2 + NumPy, 56 bytes
lambda a,b:reduce(numpy.convolve,[[1]*b]*a)
import numpy

Try it online!
I've included this solution with the above one, since they're essentially equivalent. Note that this function returns a NumPy array and not a Python list, so the output looks a bit different if you print it.
numpy.ones((a,b)) is the "correct" way to make an array for use with NumPy, and thus it could be used in place of [[1]*b]*a, but it's unfortunately longer.

Python 2, 102 91 bytes
lambda b,a:map(map(sum,product(*[range(a)]*b)).count,range(b*~-a+1))
from itertools import*

Try it online!

Pari/GP, 26 bytes
a->b->Vec((1/(1-x)%x^b)^a)

Try it online!

As far as I can tell, this is the shortest solution that definitely doesn't run out of memory on any of the provided test cases.

Haskell, 61 bytes
g x=[1..x]
a#b=[sum[1|m<-mapM g$b<$g a,sum m==n]|n<-[a..a*b]]

Try it online! Use as a#b.
Partly based on  Sherlock9's Haskell answer.

MATL, 9 bytes
:Z^!Xs8#u

Same approach as Maltysen's Pyth answer.
Inputs are in reverse order. Try it online!

Javascript (ES6), 89 bytes
b=>g=a=>a?(l=[..."0".repeat(b-1),...g(a-1)]).map((_,i)=>eval(l.slice(i,i+b).join`+`)):[1]

Takes input in currying syntax in reverse order f(b)(a)

f=b=>g=a=>a>0?(l=[..."0".repeat(b-1),...g(a-1)]).map((_,i)=>eval(l.slice(i,i+b).join`+`)):[1]
r=_=>{o.innerText=f(+inb.value)(+ina.value)}
<input id=ina type=number min=0 onchange="r()" value=0>
<input id=inb type=number min=1 onchange="r()" value=1>

AWK, 191 bytes
Outputs frequencies as a vertical column.
func p(z){for(m in z)S[z[m]]++
for(i=$1;i<=$1*$2;i++)print S[i]}func t(a,b,z,s){if(a){if(R++)for(n in z)for(i=0;i++<b;)s[n,i]=z[n]+i
else for(i=0;i++<b;)s[i]=i
t(--a,b,s)}else p(z)}{t($1,$2)}

Try it online!
Adding 6 more bytes allows for multiple sets of inputs.
func p(z,S){for(m in z)S[z[m]]++
for(i=$1;i<=$1*$2;i++)print S[i]}func t(a,b,z,s){if(a){if(R++)for(n in z)for(i=0;i++<b;)s[n,i]=z[n]+i
else for(i=0;i++<b;)s[i]=i
t(--a,b,s)}else p(z)}{R=0;t($1,$2)}

Try it online!

Perl 5, 53 bytes
$g=join',',1..<>;map$r[eval]++,glob"+{$g}"x<>;say"@r"

Try it online!
Input format:
b
a

J, 25 24 21 20 bytes
3 :'#/.~,+//y$i.{:y'

Try it online!
Initially I incremented the [0..n-1] list to get [1..n] but apparently it’s not necessary.

Nice answer.  Here's a tacit version for same number of bytes: #/.~@,@(+///)@$i.@{:.  Seems like there should be a way to shave it down a bit more making the verb dyadic, but I wasn't able to do it.

@Jonah you have an extra / in +//

Actually, you're right.  It just happens to work both ways.  I guess that solution saves a byte then :)

Actually, 13 12 bytes
-1 byte thanks to Mr. Xcoder. Try it online!
R∙♂Σ;╗╔⌠╜c⌡M

Ungolfed
                Implicit input: b, a
R∙              ath Cartesian power of [1..b]
  ♂Σ            Get all the sums of the rolls, call them dice_rolls
    ;╗          Duplicate dice_rolls and save to register 0
      ╔         Push uniquify(dice_rolls)
       ⌠  ⌡M    Map over uniquify(dice_rolls), call the variable i
        ╜         Push dice_rolls from register 0
         c        dice_rolls.count(i)
                Implict return

You do not need the @, do you?

As a side note, I found an interesting alternative: R∙♂Σ╗╜╔⌠╜c⌡M

JavaScript (ES6), 94 bytes

f=(n,m,a=[1],b=[])=>n?[...Array(m)].map((_,i)=>a.map((e,j)=>b[j+=i]=(b[j]|0)+e))&&f(n-1,m,b):a
<div oninput=o.textContent=f(+n.value,+m.value).join`\n`><input id=n type=number min=0 value=0><input id=m type=number min=1 value=1>
1

Limited by 32-bit integer overflow, but floats could be used instead at a cost of 1 byte.

Umm... this only takes one input

@HermanLauenstein Sorry, I somehow completely overlooked that part of the question... will fix shortly.

Clojure, 86 bytes
#(sort-by key(frequencies(reduce(fn[r i](for[y(range %2)x r](+ x y 1)))[0](range %))))

An example:
(def f #(...))
(f 5 4)

([5 1] [6 5] [7 15] [8 35] [9 65] [10 101] [11 135] [12 155] [13 155] [14 135] [15 101] [16 65] [17 35] [18 15] [19 5] [20 1])

C (gcc), 142 bytes
i,j,k;int*f(a,b){int*r=malloc(sizeof(int)*(1+a*~-b));r[0]=1;for(i=1;i<=a;i++)for(j=i*~-b;j>=0;j--)for(k=1;k<b&k<=j;k++)r[j]+=r[j-k];return r;}

Try it online!

sizeof(int)? Really?

@orlp environment-dependent, you know

It's allowed for a C program to assume a particular architecture. As long as it works on at least one machine. Furthermore, 8 would work on any architecture, overallocating a bit but that's ok.

r[0]=1;for(i=1;i<=a;i++)for(j=i*~-b; -> for(i=r[0]=1;i<=a;)for(j=i++*~-b; for -2 bytes.

Julia, 43 bytes
f(n,d)=reduce(conv,repmat([ones(Int,d)],n))

Try it online!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
How many chapters do I have?
The Bible is one of the most influential books ever written, and commonly cited as the best selling book of all time. It was written by approximately 40 different authors over hundreds of years before being compiled into it's current form. But what's interesting about The Bible is the way it's divided up. It is split up into 2 different testaments, which are split up into 66 smaller books, which are each split up into smaller chapters, which are each split up into individual verses.
I thought it would be a fun challenge to try to encode the number of chapters in each book in the shortest code possible. So for today's challenge, you must write a program or function that takes one of the books as input, and outputs the number of chapters in that book according to The King James Version.
You may take IO in any reasonable format, for example reading/writing STDIN/STDOUT or a file, function arguments/return values, prompting the user, etc. are all allowed. The input will always be one of the 66 books of The Bible, and only lowercase. This means that if you are given any other input, undefined behavior is allowed. Since there are only 66 possible inputs and outputs, they are all provided here, according to Wikipedia's page on Bible chapters in The King James Version:
genesis         50
exodus          40
leviticus       27
numbers         36
deuteronomy     34
joshua          24
judges          21
ruth            4
1 samuel        31
2 samuel        24
1 kings         22
2 kings         25
1 chronicles    29
2 chronicles    36
ezra            10
nehemiah        13
esther          10
job             42
psalms          150
proverbs        31
ecclesiastes    12
song of solomon 8
isaiah          66
jeremiah        52
lamentations    5
ezekiel         48
daniel          12
hosea           14
joel            3
amos            9
obadiah         1
jonah           4
micah           7
nahum           3
habakkuk        3
zephaniah       3
haggai          2
zechariah       14
malachi         4
matthew         28
mark            16
luke            24
john            21
acts            28
romans          16
1 corinthians   16
2 corinthians   13
galatians       6
ephesians       6
philippians     4
colossians      4
1 thessalonians 5
2 thessalonians 3
1 timothy       6
2 timothy       4
titus           3
philemon        1
hebrews         13
james           5
1 peter         5
2 peter         3
1 john          5
2 john          1
3 john          1
jude            1
revelation      22

Since this challenge is about finding the optimal way to encode every book name and chapter count, using any builtins that give information about The Bible are not permitted. However, since it would be interesting to see which languages have such builtins, feel free to share a second non-competing version along with your answer. Fetching information from external sources is also not permitted (none of the standard loopholes are allowed, but I thought it would be useful to explicitly mention that one).
As usual, this is a code-golf challenge, so try to make the shortest possible program (measured in bytes) as you can. Have fun golfing!

The output is not fixed, so why is this [tag:kolmogorov-complexity]?

@LyricLy Because even though the output is not fixed, it is still about seeing the most efficient way to generate two different sets of data: 1) The names of the books (or a portion of the name long enough to recognize it) and 2) The corresponding number of chapters.

you just see all the ones with a normal amount and then just psalms which is like HALF THE BIBLE

@HyperNeutrino No, a lot if its "chapters" (individual psalms) are very short. There is only one long psalm, number 119, which is also The Bible's longest chapter.

@Adám I know most of them are really short and it's really not too much longer than other books :P but still it has like almost 3 times more than the otherwise maximum

@HyperNeutrino Also, the chapter divisions were later Christian additions. The original (OT) texts do not have chapter numbering.

@Adám Hm that's interesting. Thanks for the info! :)

I wanna enklact my way out of this challenge but I can't...

@icrieverytim Provably impossible. The shortest book, Job is three characters and the first three columns are not unique.

@DJMcMayhem You've forgotten the fact that there are not 66 unique letters. :P

@icrieverytim I do suppose that is a bigger and more obvious problem XD

@icrieverytim Hahaha, enklact should be a new word in the PPCG dictionary xD

Jelly compressed string that contains the data. I don't actually know Jelly (and I also made a few mistakes while encoding the data, but I don't know how to fix them without re-doing the whole thing) but maybe somebody can put this to good use.

@ETHproductions to enklact (v): to implement a lookup table using a subsection consisting of unique elements. This could even be a me— oops, I almost said the m-word. :P

There's no need to generate the names of books, or even sub-sections thereof. That half of the problem is near-perfect hashing rather than KC. Overall this type of question is one of the subtypes that least deserves the KC tag; @LyricLy, if you feel strongly then you could revive the issue on meta with a proposed name for this type of lookup question.

Jelly, 127 bytes
“£ÐgƁ÷ḅ*Wßßɦ*⁷ċṗṿỵ×Ɓṿ⁷ḢQ’b7+\;“BƝ‘
OḄ;407;270;“ọḷḊḲɦ‘%/i@“¡Ṙ×!⁸Ọ5`ỊV-ṙQȷṖÞ(sĿȮ^k³M"ɓmEf¤*0C[ạƇŻȥ#BṚñİmZẓeȦUƈ!ċ€@Ȧʋ)ƙḅyẉ’b158¤ị¢

Try it online!
Test Cases
How it Works
Essentially, this tries to convert the ords of the characters input into a binary value, for example "joel" -> [106, 111, 101, 108]-> 2^3*106 + 2^2*111 + 2^1*101 + 2^0*108.
Then, this value is taken mod 407, then mod 270, then [a few more mods], then mod 160. This is useful because it maps all 66 string inputs to integers between 0 and 158 (lucky on final mod).
The integer is indexed from the integer list “ọḷḊḲɦ...ƙḅyẉ’b158¤ to find the value of n such that the input has the n-th least number of chapters. Joel happens to have the 7-th least number of chapters.
This value of n is further indexed into the list “£ÐgƁ÷ḅ*Wßßɦ*⁷ċṗṿỵ×Ɓṿ⁷ḢQ’b7+\;“BƝ‘ to find the exact number of chapters.
Possible improvement: inputs with the same number of chapters can hash to the same value from the mods (0% collision is not necessary), but I did not account for that in my program to determine the sequence of mods.

126 bytes

Save a byte by avoiding @ (%/i@“...’b158¤ị¢ -> %/“...’b158¤iị¢). Save another byte by using an offset of 160 to a single code-page index list at the start (OḄ;407;270;“ọḷḊḲɦ‘ -> OḄ;“ẋn=:!×¡‘+160¤).

JavaScript (ES6), 251 197 bytes
s=>`-  cE1$ " +%&  %  &!!· $!#&!!)!'=6 &!6".!  -!!Q$"/  779@@= % & $'1 U( I>!!  K * "S< :  9$!C %  . $. 9E1/ %!!'" + $ % `.split`!`.join`   `.charCodeAt(parseInt(s[2]+s[0]+s[5],36)%913%168%147)-33

Test

let f =

s=>`-  cE1$ " +%&  %  &!!· $!#&!!)!'=6 &!6".!  -!!Q$"/  779@@= % & $'1 U( I>!!  K * "S< :  9$!C %  . $. 9E1/ %!!'" + $ % `.split`!`.join`   `.charCodeAt(parseInt(s[2]+s[0]+s[5],36)%913%168%147)-33

o.innerText = [
  ["genesis",         50 ],
  ["exodus",          40 ],
  ["leviticus",       27 ],
  ["numbers",         36 ],
  ["deuteronomy",     34 ],
  ["joshua",          24 ],
  ["judges",          21 ],
  ["ruth",            4  ],
  ["1 samuel",        31 ],
  ["2 samuel",        24 ],
  ["1 kings",         22 ],
  ["2 kings",         25 ],
  ["1 chronicles",    29 ],
  ["2 chronicles",    36 ],
  ["ezra",            10 ],
  ["nehemiah",        13 ],
  ["esther",          10 ],
  ["job",             42 ],
  ["psalms",          150],
  ["proverbs",        31 ],
  ["ecclesiastes",    12 ],
  ["song of solomon", 8  ],
  ["isaiah",          66 ],
  ["jeremiah",        52 ],
  ["lamentations",    5  ],
  ["ezekiel",         48 ],
  ["daniel",          12 ],
  ["hosea",           14 ],
  ["joel",            3  ],
  ["amos",            9  ],
  ["obadiah",         1  ],
  ["jonah",           4  ],
  ["micah",           7  ],
  ["nahum",           3  ],
  ["habakkuk",        3  ],
  ["zephaniah",       3  ],
  ["haggai",          2  ],
  ["zechariah",       14 ],
  ["malachi",         4  ],
  ["matthew",         28 ],
  ["mark",            16 ],
  ["luke",            24 ],
  ["john",            21 ],
  ["acts",            28 ],
  ["romans",          16 ],
  ["1 corinthians",   16 ],
  ["2 corinthians",   13 ],
  ["galatians",       6  ],
  ["ephesians",       6  ],
  ["philippians",     4  ],
  ["colossians",      4  ],
  ["1 thessalonians", 5  ],
  ["2 thessalonians", 3  ],
  ["1 timothy",       6  ],
  ["2 timothy",       4  ],
  ["titus",           3  ],
  ["philemon",        1  ],
  ["hebrews",         13 ],
  ["james",           5  ],
  ["1 peter",         5  ],
  ["2 peter",         3  ],
  ["1 john",          5  ],
  ["2 john",          1  ],
  ["3 john",          1  ],
  ["jude",            1  ],
  ["revelation",      22 ]
]
.every(s => (log += s[0] + ' --> ' +  (res = f(s[0])) + '\n', res == s[1]), log = '')
? log + '\nSUCCESS' : log + '\nFAIL'

Formatted and commented
s =>                                 // s = book name
  `-  cE1$ " +%&  %  &!!· (...)`     // data string (truncated)
  .split`!`.join`   `                // inflate padding characters '!' -> 3 spaces
  .charCodeAt(                       // read the ASCII code at the position found by
    parseInt(s[2] + s[0] + s[5], 36) // parsing 3 characters of the input in this exact
    % 913 % 168 % 147                // order as base 36 and applying three consecutive
  ) - 33                             // modulo operations, then subtract 33

You are officially the master of finding the most efficient hashing method in JS... Or do you have a program which finds methods for you? ;)

@ETHproductions I did write a generic Node program at some point, but it's not especially fast so I end up writing custom code most of the time... O_o

Excel, 373 bytes
Reusing @Misha's approach from the Mathematica answer (6a+b+8c+5d+3e modulo 151):
=CHOOSE(MOD(6*CODE(LEFT(A1,1))+CODE(MID(A1,2,1))+8*CODE(MID(A1,3,1))+5*CODE(MID(A1&A1,4,1))+3*CODE(MID(A1&A1,5,1)),151)+1,30,,,,27,,,,3,12,,,9,,149,,,28,,,13,,,35,3,,35,7,,8,,20,,49,23,13,4,,,4,,,,,,,2,,,39,,,15,3,,3,9,,12,27,,,,,,51,15,,,,70,,65,,21,11,,,4,,24,,,6,,2,1,,,,,,2,,,30,,,,,,23,,,33,,20,,,15,,,4,,4,,,12,2,,2,47,23,,2,,,,,41,,,3,,,5,,,,,11,,21,5,,,,5,2,3,26)+1
Lookup returns chapters -1, and then add the one.  This changes 10 into 9 twice, and ,1, into ,, 4 times.
Updated to old approach. Excel, 460 401 bytes
Save as CSV, Book Name entered at end of first line (C1), result displayed in C2:
1c,16,revelation
1co,29,"=VLOOKUP(LEFT(C1,1)&MID(C1,3,1)&MID(C1,6,1),A:B,2)"
1j,5
1k,22
1p,5
1s,31
1t,6
1ts,5
2c,13
2co,36
2j,1
2k,25
2p,3
2s,24
2t,4
2ts,3
3j,1
a,9
at,28
c,4
d,12
du,34
e,12
ee,48
eh,6
eo,40
er,10
g,6
gn,50
h,3
hbw,13
hg,2
hs,14
i,66
j,42
jd,1
jds,21
je,3
jh,21
jm,5
jn,4
jr,52
js,24
lm,5
lv,27
m,7
ml,4
mr,16
mt,28
n,3
nhi,13
nm,36
o,1
p,150
pi,1
pip,4
po,31
r,16
rt,4
rv,22
s,8
t,3
zc,14
zp,3
For the lookup table, we can leave out et 10 and l 24 because these match on er 10 and js 24 respectively.

We don't see excel formula answers very often that require a lookup table. Upvote for the novelty and the execution. You might want to search/post some meta questions about scoring in excel. Specifically, I think you might owe a couple more bytes for the layout of the A column. Also, you probably want to move A to C and B:C to A:B so you don't get "charged" for all the empty cells in A. Off the top of my head, I think the size of the TSV/CSV text file for the whole sheet might be the right score?

Generally, I think that the bytecount of the characters in the .csv file (in this case minus the bytecount of the included input value) should be the score of these types of Excel answer - which by my count leaves the above at a score of 401 bytes

@TaylorScott, I had CR-LF as new line characters.  Assume the 401 v. 464 is because of this?

@Wernisch, in short, yes - you can assume that the linefeeds are stored as the ASCII character literal with charcode 10, meaning that they count as 1 byte

Mathematica: 323 294 bytes
Uncompress["1:eJxTTMoPSpvOwMBQzAIkfDKLSzJlgAwCBEhtJi8qwQUnpqESsqgEHyqhAjePBc7lgBOccEIUThiBCAm4AayECUZUghmV0EAlBFAdxILqN17CgWMCNwUn4QQnxEAEDyqBcLgkKsGO6gUmLAROX8rjJSRQCSU4IYpKILzAiDfEebG4wADVDmZchBYqgRYVbLgIRPiJ4VXHDDdKGuZ9AAP6TUg="][[Mod[ToCharacterCode@StringTake[#<>#,5].{6,1,8,5,3},151,1]]]&

How it works
For a book beginning with character codes a,b,c,d,e (wrapping around if necessary) computes 6a+b+8c+5d+3e modulo 151, which happens to be unique, and then looks up the number of chapters in a compressed list of length 151. (Unused entries in the list are filled in with duplicates of the previous entry. This encourages run-length encoding, maybe? Anyway, it helps.)
Thanks to @numbermaniac for the list compression idea, which is hard to put a number on but is a huge part of the improvement here.
Old version: Mathematica, 548 435 407 bytes
Join["111112333333344444455555666789"~(p=StringPartition)~1,"1010121213131314141616162121222224242425272828293131343636404248505266"~p~2,{"150"}][[Max@StringPosition["2jn3jnjduoaapimhgi2pe2tshbkjeonhntttzpn2toclsjnjmlhpiprtu1jn1pe1tsjmjlmt1toehiglimcmsnoaometrerzdnlecs2cihbwnhihshzcr1cimrarmsjhojds1kgrva2sujsalku2kglviatcmte1co1supordur2conmreosjbbeeegnijriiahpas",""<>#&@Characters[#<>#][[{1,3,6}]]]/3]]&

How it works
We convert each name name to characters 1, 3, and 6 of namename (e.g. leviticus becomes lvi, job becomes jbb) before looking it up.
The list we look things up in is slightly compressed by putting the 1-digit and the 2-digit chapter numbers together in strings.
Mathematica: 40 bytes, non-competing
WolframAlpha["# chapters "<>#,"Result"]&

Yeah.

If you use Compress on the list, you get a string that can be turned back into the list with Uncompress in your program; the whole function comes out to 430 bytes, saving you 5 :)

Thanks! That version of the program had better ways to shorten the list, but this worked out very well for the new approach I found :)

I really hoped a second Mathematica answer would contain a Bible Built-in

There's no built-in; there's WolframAlpha["number of chapters of "<>#,"Result"]&, but somehow that doesn't feel like quite the same thing.

Wait why is the 40 byte solution non-competing? What's different about it / what does it do

It looks up the answer on Wolfram Alpha, which is called out as cheating both in the standard loopholes and explicitly in the question. (Although I think that if I included Wolfram Alpha's source code and database in the byte count, that would make it okay again.)

Python 2, 244 183 bytes
lambda n:ord('A("4,|O|;|>||_ /\xb5$+_>| _7|a|5-##_"_G"_/|7) $_$-|<|$_"&|||_;S_% |:_45_#||#|%7"_,_\'_)|_"|C_#|/_I|$_ "|,|_%|_8_Q|+||||_!|_C#'.replace('|','__')[hash(n)%839%434%152])-31

Try it online!

You might want to give a go at https://codegolf.stackexchange.com/questions/76781/tweetable-hash-function-challenge/129450 :)

Jelly,  117 115  114 bytes
OP%⁽µW%⁽£İ%237
“ĿḊƘ⁹ƙƬṂ;ɓṭ6-ạʋ⁵%$Ẋf,¥ÆÑƈø¬ȦṘd⁾“ʂụṿⱮẆƊ¦ẠLjƒ~Ḅr©“Ẏw|!¡¢o“ŻɗṢ“3ɠ‘Zċ€ÇTḢị“£ẆJQ+k⁽’ḃ6¤+\;“£¬®µıñø"BƝ¤‘¤

Try it online! or see the test-suite
How?
Hashes the product of the ordinals of the characters of the input string by taking three two three division remainders, looks up the result in a list of lists and uses the found index to look up the result in a list of book lengths.
When finding a hash function I only considered those which resulted in at most one bucket with any results over 255 to allow code-page indexing and then chose ones that minimised the total number of values to encode (after removing the "offending" bucket or if none existed the longest bucket). From 66 with three modulos I found a 59 (%731%381%258) a 58 (%731%399%239) then one with 56 entries (%1241%865%251) [making for 117 bytes] ...I then found a 58 using only two remainders (%1987%251) [making for 115 bytes]
...then I found a 55 using three remainders, which when two dummy entries are added allows for a further compression of the lookup list...
The code:
1.
“ĿḊƘ⁹ƙƬṂ;ɓṭ6-ạʋ⁵%$Ẋf,¥ÆÑƈø¬ȦṘd⁾“ʂụṿⱮẆƊ¦ẠLjƒ~Ḅr©“Ẏw|!¡¢o“ŻɗṢ“3ɠ‘

is a list of five lists of code-page indices (“...“...“...“...“...“...‘):
[[199,193,148,137,161,152,179,59,155,224,54,45,211,169,133,37,36,208,102,44,4,13,16,156,29,7,190,204,100,142],[167,225,226,149,207,145,5,171,76,106,158,126,172,114,6],[209,119,124,33,0,1,111],[210,157,183],[51,159]]

This is transposed using the atom Z to get the buckets; call this B:
[[199,167,209,210,51],[193,225,119,157,159],[148,226,124,183],[137,149,33],[161,207,0],[152,145,1],[179,5,111],[59,171],[155,76],[224,106],[54,158],[45,126],[211,172],[169,114],[133,6],37,36,208,102,44,4,13,16,156,29,7,190,204,100,142]

(the 0 and 1 are the dummy keys, allowing the [179,5,111] to be two further to the right - the transpose requires longer entries to be to the left)
2.
“£ẆJQ+k⁽’ḃ6¤+\;“£¬®µıñø"BƝ¤‘¤

Call this C (the chapter counts) - it's a list of integers:
[1,4,5,6,10,12,13,14,16,21,22,24,28,31,36,40,42,48,50,52,2,7,8,9,25,27,29,34,66,150,3]

and is constructed as follows (the two dummy keys above therefore allow 10,12,13 to be in ascending order):
“£ẆJQ+k⁽’ḃ6¤+\;“£¬®µıñø"BƝ¤‘¤
                            ¤ - nilad followed by link(s) as a nilad:
           ¤                  -   nilad followed by link(s) as a nilad:
“£ẆJQ+k⁽’                     -     base 250 number = 935841127777142
         ḃ6                   -     converted to bijective base 6 = [1,3,1,1,4,2,1,1,2,5,1,2,4,3,5,4,2,6,2,2]
            +\                -     cumulative reduce with addition = [1,4,5,6,10,12,13,14,16,21,22,24,28,31,36,40,42,48,50,52]
               “£¬®µıñø"BƝ¤‘  -   code-page indices = [2,7,8,9,25,27,29,34,66,150,3]
              ;               -   concatenate = [1,4,5,6,10,12,13,14,16,21,22,24,28,31,36,40,42,48,50,52,2,7,8,9,25,27,29,34,66,150,3]

Now the simplified version of the code is:
OP%⁽µW%⁽£İ%237 - Link 1, hash function: list of characters   e.g. "genesis"
O              - cast to ordinals             [103,101,110,101,115,105,115]
 P             - product                                    160493569871250
   ⁽µW         - base 250 literal                                      3338
  %            - modulo                                                1050
       ⁽£İ     - base 250 literal                                      1699
      %        - modulo                                                1050
           237 - literal                                                237
          %    - modulo                                                 102

Bċ€ÇTḢịC - Main link: list of characters                     e.g. "genesis"
B        - the list of buckets, B, described  in (1) above
   Ç     - call the last link as a monad (get the hashed value)         102
 ċ€      - count for €ach - yields 29 zeros and a one or 30 zeros       [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0]
    T    - truthy indexes - yields a list of length one or zero         [19]
     Ḣ   - head - extracts that value or zero if it was empty            19  ----------------------------------------------v
       C - the list of chapter lengths, C, described in (2) above       [1,4,5,6,10,12,13,14,16,21,22,24,28,31,36,40,42,48,50,52,2,7,8,9,25,27,29,34,66,150,3]
      ị  - index (the head value) into (the chapter list, c)             50
         -       - 1-indexed and modular so 0 yields 3 (the rightmost)

Python 2, 438 429 416 411 409 bytes
lambda s:[c for x,c in zip('A|m|C|h|2|th|2 Co|D|y|E|Ep|Ec|x|ze|G|Ge|H|gg|He|Ho|I|Jo|oe|oh|na|sh|Ju|dg|Ja|Je| J|1 J|K|2 K|L|Le|Lu|M|ch|rk|tt|N|Ne|Nu|O|P|Pr|Ph|pp|Pe|2 P|R|Ro|Ru|S|Sa|2 S|T| T|2 T| Ti|2 Ti|Z|Zep'.split('|'),(28,9,4,29,36,16,13,12,34,10,6,12,40,48,6,50,3,2,13,14,66,42,3,21,4,24,1,21,5,52,1,5,22,25,5,27,24,7,4,16,28,3,13,36,1,150,31,1,4,5,3,22,16,4,8,31,24,3,5,3,6,4,14,3))if x in s.title()][-1]

Try it online!
Works by changing the input to Title Case, and finding the last matching substring in the list.
[('A', 28), ('m', 9), ('C', 4), ('h', 29), ('2', 36), ('th', 16), ('2 Co', 13), ...

Eg. '1 samuel' -> '1 Samuel' which matches ('m', 9), ('2', 36), ('S', 8), ('Sa', 31), ('2 S', 24). The last match is ('2 S', 24), so the answer is 24

6502 machine code (C64), 204 bytes
00 C0 20 FD AE 20 9E AD 85 FD 20 A3 B6 A9 1E 85 FB A9 00 85 FC A8 B1 22 18 69
4A 65 FC 45 FB 85 FC E6 FB C8 C4 FD D0 EE A5 FC 4A 4A 4A 4A A8 A5 FC 29 0F 19
BA C0 A8 BE 3D C0 A9 00 4C CD BD 16 34 42 0D 01 00 04 03 04 1C 0A 00 06 15 07
00 16 00 22 03 02 0E 00 24 00 00 01 00 08 03 00 1C 03 01 00 00 00 00 00 03 03
00 00 00 24 10 1F 18 0E 10 00 00 00 32 30 1F 2A 00 0D 00 05 00 1B 00 0A 00 01
28 00 00 0C 96 00 10 00 00 00 18 00 00 03 00 00 00 00 00 00 15 09 00 05 00 04
00 00 04 00 00 04 00 00 18 00 1D 05 00 00 19 00 0D 00 00 06 06 0C 00 00 00 00
05 00 01 00 05 00 04 30 10 20 10 40 70 00 00 20 50 00 10 60 30 20

Explanation:
The key here is to use a special hashing function that maps without collissions to values 0 to 125 *). The chapter numbers are then placed in a 126 bytes table. The hashing is done in full 8 bits, the final value is adjusted by looking up the high nibbles in yet another table, this way combining different high nibbles where the low nibbles don't collide.
Here's a commented disassembly listing of the code part:
.C:c000  20 FD AE    JSR $AEFD          ; consume comma
.C:c003  20 9E AD    JSR $AD9E          ; evaluate argument
.C:c006  85 FD       STA $FD            ; remember string length
.C:c008  20 A3 B6    JSR $B6A3          ; free string ....
.C:c00b  A9 1E       LDA #$1E           ; initial xor key for hash
.C:c00d  85 FB       STA $FB
.C:c00f  A9 00       LDA #$00           ; initial hash value
.C:c011  85 FC       STA $FC
.C:c013  A8          TAY
.C:c014   .hashloop:
.C:c014  B1 22       LDA ($22),Y        ; load next string character
.C:c016  18          CLC                ; clear carry for additions
.C:c017  69 4A       ADC #$4A           ; add fixed offset
.C:c019  65 FC       ADC $FC            ; add previous hash value
.C:c01b  45 FB       EOR $FB            ; xor with key
.C:c01d  85 FC       STA $FC            ; store hash value
.C:c01f  E6 FB       INC $FB            ; increment xor key
.C:c021  C8          INY                ; next character
.C:c022  C4 FD       CPY $FD            ; check for string length
.C:c024  D0 EE       BNE .hashloop      ; end of string not reached -> repeat
.C:c026   .hashadjust:
.C:c026  A5 FC       LDA $FC            ; load hash
.C:c028  4A          LSR A              ; shift left four times
.C:c029  4A          LSR A
.C:c02a  4A          LSR A
.C:c02b  4A          LSR A
.C:c02c  A8          TAY                ; and copy to y index register
.C:c02d  A5 FC       LDA $FC            ; load hash again
.C:c02f  29 0F       AND #$0F           ; mask low nibble
.C:c031  19 BA C0    ORA $C0BA,Y        ; and add high nibble from table
.C:c034  A8          TAY                ; copy to y index register
.C:c035  BE 3D C0    LDX .chapters,Y    ; load chapter number from table
.C:c038  A9 00       LDA #$00           ; accu must be 0 for OS function:
.C:c03a  4C CD BD    JMP $BDCD          ; print 16bit value in A/X

after that follows a table of the chapter numbers and finally a table of the high nibbles for the hash value.
Online demo
Usage: sys49152,"name", for example sys49152,"genesis" (output 50).
Important: If the program was load from disk (like in the online demo), issue a new command first! This is necessary because loading a machine program trashes some C64 BASIC pointers.
Hint about the casing: In the default mode of the C64, the input will appear as upper case. This is in fact lowercase, but the C64 has two modes and in the default upper/graphics mode, lowercase characters appear as uppercase and uppercase characters appear as graphics symbols.

*) of course, this isn't as dense as it could be ... oh well, maybe I find an even better solution later ;)

Java 8, 623 597 590 bytes
s->{int i=s.chars().map(c->c*c*c).sum()/13595;return s.contains("tt")?28:i<258?42:i<355?1:i<357?3:i<362?16:i<366?28:i<369?21:i<375?9:i<377?24:i<380?5:i<382?1:i<386?10:i<402?7:i<436?4:i<438?5:i<439?14:i<461?3:i<463?2:i<477?22:i<478?25:i<490?5:i<491?3:i<493?12:i<500?66:i<545?3:i<546?1:i<548?21:i<562?4:i<568?24:i<570?10:i<572?31:i<573?24:i<582?16:i<583?150:i<607?40:i<629?48:i<639?50:i<663?13:i<675?3:i<677?36:i<679?52:i<734?1:i<735?6:i<736?4:i<775?14:i<785?6:i<796?3:i<800?31:i<812?6:i<876?27:i<910?29:i<911?36:i<940?22:i<1018?4:i<1035?16:i<1036?13:i<1066?12:i<1092?34:i<1229?5:i<1230?3:8;}

-7 bytes thanks to @Nevay by changing the for-loop to a stream.
Can definitely be golfed more.. Just need to do some more testing.
It may not be the shortest answer by a long shot, and could be golfed by porting some existing answer, but I'm still proud to come up with something myself.. :)
Explanation:
Try it here.

Takes the power of 3 of each character (as ASCII value) in the input String
Takes the sum of those
Divides the result by 13595 as integer division (in Java this automatically truncates/floors the result).
This leaves 65 unique values (only habakkuk and matthew both have a value of 674)
And then one giant ternary-if to return the correct result (with a few values combining in a single ternary-statement where possible (381 and 382 both 1; 425 and 436 both 4; 649 and 663 both 13; 952 and 1018 both 4; 1122 and 1229 both 5).

You can use int i=s.chars().map(c->c*c*c).sum()/13595; instead of int i=0;for(int c:s.getBytes())i+=c*c*c;i/=13595;.


text:
Back to the Basics of Math
Introduction:
We all know these three basic arithmetic math tables I assume.
ADDITION:
 + | 1  2  3  4  5  6  7  8  9  10
----------------------------------
1  | 2  3  4  5  6  7  8  9  10 11
2  | 3  4  5  6  7  8  9  10 11 12
3  | 4  5  6  7  8  9  10 11 12 13
4  | 5  6  7  8  9  10 11 12 13 14
5  | 6  7  8  9  10 11 12 13 14 15
6  | 7  8  9  10 11 12 13 14 15 16
7  | 8  9  10 11 12 13 14 15 16 17
8  | 9  10 11 12 13 14 15 16 17 18
9  | 10 11 12 13 14 15 16 17 18 19
10 | 11 12 13 14 15 16 17 18 19 20

SUBTRACTION:
 - | 1  2  3  4  5  6  7  8  9  10
---------------------------------
1  | 0  1  2  3  4  5  6  7  8  9
2  | -1 0  1  2  3  4  5  6  7  8
3  | -2 -1 0  1  2  3  4  5  6  7
4  | -3 -2 -1 0  1  2  3  4  5  6
5  | -4 -3 -2 -1 0  1  2  3  4  5
6  | -5 -4 -3 -2 -1 0  1  2  3  4
7  | -6 -5 -4 -3 -2 -1 0  1  2  3
8  | -7 -6 -5 -4 -3 -2 -1 0  1  2
9  | -8 -7 -6 -5 -4 -3 -2 -1 0  1
10 | -9 -8 -7 -6 -5 -4 -3 -2 -1 0

MULTIPLICATION:
 * | 1  2  3  4  5  6  7  8  9  10
----------------------------------
1  | 1  2  3  4  5  6  7  8  9  10
2  | 2  4  6  8  10 12 14 16 18 20
3  | 3  6  9  12 15 18 21 24 27 30
4  | 4  8  12 16 20 24 28 32 36 40
5  | 5  10 15 20 25 30 35 40 45 50
6  | 6  12 18 24 30 36 42 48 54 60
7  | 7  14 21 28 35 42 49 56 63 70
8  | 8  16 24 32 40 48 56 64 72 80
9  | 9  18 27 36 45 54 63 72 81 90
10 | 10 20 30 40 50 60 70 80 90 100

For the sake of this challenge, division is excluded.

Sequence definition:
We will follow the same steps for both a 0-indexed and 1-indexed sequence. So the resulting sequence will become f(0)+g(1), f(1)+g(2), etc.

Both f (0-indexed) and g (1-indexed) start in the ADDITION table at (1,1). So f(0) = 1+1 = 2 and g(1) = 1+1 = 2.
We then go to the SUBTRACTION table, and we either go n steps down if n is odd, or n steps to the right if n is even. So f(1) = 1-2 = -1 (it went to the down, because n=1 is odd); and g(2) = 3-1 = 2 (it went right, because n=2 is even).
Then we go to the MULTIPLICATION table, and do the same: f(2) = 3*2 = 6 and g(3) = 3*4 = 12.
And then we go back to the ADDITION table again. Also, when we go beyond the borders of the 10x10 table, we wrap around from the bottom to the top, or from the right to the left. So going from (7,9) six steps right, will end up at (3,9).

The resulting sequence will be f(n)+g(n+1) (with n being 0-indexed).
Here the first six in colors, in the order green → blue → purple → grey → red → orange:
f (0-indexed): (1+1) → (1-2) → (3*2) → (3+5) → (7-5) → (7*10)

g (1-indexed): (1+1) → (3-1) → (3*4) → (7+4) → (7-9) → (3*9)

The resulting sequence is the sum of both these sequences.
Here are the first 100 items of the 0-indexed sequence f:
2,-1,6,8,2,70,13,-4,7,7,-5,7,10,-7,70,12,-2,6,3,0,1,3,1,15,12,-3,30,10,-6,6,7,-6,21,13,-3,35,8,1,2,2,0,2,5,-2,35,17,-7,21,8,-5,6,8,-4,30,17,2,15,5,-1,1,2,-1,6,8,2,70,13,-4,7,7,-5,7,10,-7,70,12,-2,6,3,0,1,3,1,15,12,-3,30,10,-6,6,7,-6,21,13,-3,35,8,1,2,2

Here are the first 100 items of the 1-indexed sequence g:
2,2,12,11,-2,27,9,-5,5,6,-5,18,12,-2,28,7,2,1,11,-9,1,4,-1,28,16,-6,18,7,-4,5,7,-3,27,16,3,12,4,0,10,11,0,3,7,3,63,12,-3,6,6,-4,6,9,-6,63,11,-1,3,2,-9,10,2,2,12,11,-2,27,9,-5,5,6,-5,18,12,-2,28,7,2,1,11,-9,1,4,-1,28,16,-6,18,7,-4,5,7,-3,27,16,3,12,4,0,10,11

Here are the first 100 items of the result sequence:
4,1,18,19,0,97,22,-9,12,13,-10,25,22,-9,98,19,0,7,14,-9,2,7,0,43,28,-9,48,17,-10,11,14,-9,48,29,0,47,12,1,12,13,0,5,12,1,98,29,-10,27,14,-9,12,17,-10,93,28,1,18,7,-10,11,4,1,18,19,0,97,22,-9,12,13,-10,25,22,-9,98,19,0,7,14,-9,2,7,0,43,28,-9,48,17,-10,11,14,-9,48,29,0,47,12,1,12,13

Challenge:
Given an integer n, output the n'th number of the above result sequence (which sums both the 0-indexed and 1-indexed sequences). So calculate h(n) = f(n)+g(n+1).
Challenge rules:

The result-sequence is always 0-indexed. I know some languages are 1-indexed by default, in which case you'll have to do n-1 right after entering the function/program so f(n)+g(n+1) will start at f(0)+g(1) (and not f(1)+g(2)).
Output can be in any reasonable format, so a String or decimal with .0 instead of an integer is allowed.
As you may or may not have noted; in the tables above the number at the top is taken first, then the number at the left.

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code.
Also, please add an explanation if necessary.

Test cases (0-indexed):
0       4
1       1
2       18
3       19
4       0
5       97
10      -10
50      12
60      4
61      1
62      18
63      19
100     0
111     17
1000    0
1994    98
2497    1
2498    12
2499    13
2500    0

Note/tip: The sequences are self-repeating every 60 items.

Darn.

@icrieverytim Hehe, sorry about that. Came up with the sequence myself. Then again, I have come up with sequences in the past which did have an existing OEIS page. ;)

This one surprised me. I didn't even search for it on OEIS since I came up with it myself and thought it was an original idea.

Probably missing something obvious, but in the subtraction step of your sequence definition, I don't see how g(2) got to position (5, 7) by going 2 steps to the left...

@Jonah g(2) = 3-1 = 2. I'm not sure where you're seeing the (5,7) tbh.. Unless I'm reading past it. Could you give a quote of where you see the g(2) with (5,7)?

Maybe I'm misinterpreting something here, but it seems like you're going to the right when it is even, not to the left. E.g. f(1) is at (1,2), and f(2) is 2 steps to the right at (3,2).

Originally I was looking at the f picture when I should have been looking at the g picture, hence the (5, 7) confusion.  But now I'm still confused per RothX's comment.  The blue square in the g picture has moved right 2 spaces...

05AB1E, 48 47 43 42 bytes
1-indexed.
¾4×SsFD2äεT%>`…+-*Nè.V}Os0NÌ‚ÂTS-‚Nƒí}˜+}\

Try it online!
or see the Whole sequence
Explanation
¾4×S                                         # initialize stack with [0,0,0,0]
    sF                                  }    # for N in range [0 ... input-1] do:
      D                                      # duplicate
       2äε            }                      # for each pair of values
          T%>                                # get last digit of each and increment
              …+-*Nè                         # index into "+-*" with N
             `      .V                       # apply the function to our values
                       O                     # sum the pair
                        s                    # swap the list of 4 values to the top
                         0NÌ‚                # push [0, N+2]
                             ÂTS-            # bifurcate and subtract [1,0]
                                 ‚           # pair, resulting in [[0,N+2],[N+1,0]]
                                  Nƒí}       # reverse each pair N+1 times
                                      ˜+     # flatten and add to the list of values
                                               from last iteration
                                         \   # discard the final list

¾4×S can be 4Å0 or ¾4и now for -1 byte.

APL (Dyalog), 77 bytes
Full program which prompts for n, looks up the result in the list of 60 possible results, and prints that to STDOUT.
¯50+⎕AV⍳'63DE2èHy£¢xKHyéE29∆y492ýNyÂCx$∆yÂO2Á£3£¢27£3éOxM∆y£CxäN3D9x$'[60|⎕]

Try it online!
'…'[…] index the string by the following:
 ⎕ prompt for n
 60| remainder when dividing by 60
⎕AV⍳ find ɩndices in the Atomic Vector (the character set)
¯50+ add negative fifty

Python 3, 89 bytes
lambda i:ord('HEVWD¥Z;PQ:]Z;¦WDKR;FKDo`;tU:OR;taDsPEPQDIPE¦a:_R;PU:¡`EVK:O'[i%60])-68

Try it online!

JavaScript (ES6), 95 ... 84 82 bytes
This is the best I could come up with so far without hardcoding the sequence.
Edit: Now probably shorter than hardcoding anyway.
m=>(g=(x,y=n=1)=>n>m?[x*y,x+y,n+o--&1?y-x:x-y][n%3]:g((y-o+n++)%10+1,x))(o=1)+g(1)

Demo

let f =

m=>(g=(x,y=n=1)=>n>m?[x*y,x+y,n+o--&1?y-x:x-y][n%3]:g((y-o+n++)%10+1,x))(o=1)+g(1)

;[0, 1, 2, 3, 4, 5, 10, 50, 60, 61, 62, 63, 100, 111, 1000]
.forEach(i => {
  console.log(`a(${i}) = ${f(i)}`)
});

Formatted and commented
m => (                              // m = input
  g = (                             // g = recursive function using:
    x, y = n = 1                    //   (x,y) = coordinates, n = counter
  ) =>                              //   and o = offset (0 or 1)
    n > m ?                         // if n is greater than the input:
      [                             //   evaluate the current cell in the current table
        x * y,                      //   both multiplication
        x + y,                      //   and addition are commutative
        n + o-- & 1 ? y - x : x - y //   but subtraction is not: we need to make sure that
      ][n % 3]                      //   x and y are set in the correct order
    :                               // else:
      g(                            //   do a recursive call to g():
        (y - o + n++) % 10 + 1,     //     updating y and using it as x; incrementing n
        x                           //     using x as y
      )                             //   end of recursive call
  )(o = 1) + g(1)                   // invoke g() with o = 1; then o = 0; return the sum

Excel, 188 bytes
Hardcoded results:
=CHOOSE(MOD(A1,60)+1,5,2,19,20,1,98,23,-8,13,14,-9,26,23,-8,99,20,1,8,15,-8,3,8,1,44,29,-8,49,18,-9,12,15,-8,49,30,1,48,13,2,13,14,1,6,13,2,99,30,-9,28,15,-8,13,18,-9,94,29,2,19,8,-9,12)-1
Saved 3 bytes by adding 1 to all results in lookup, then subtracting at end.  This turns -10 into -9 5 times.

PowerShell, 81 bytes (UTF-8)
'HEVWD¥Z;PQ:]Z;¦WDKR;FKDo`;tU:OR;taDsPEPQDIPE¦a:_R;PU:¡`EVK:O'["$args"%60]-68

Try it online!
Port of ovs' answer to PowerShell. Since after reading the challenge, I was going to do something similar, it's easier to just re-use the string.

Haskell, 159 155 bytes
EDIT: thanks to Laikoni for taking off 4 bytes!
((z(+)(a 1)$a 0)!!)
p#n=mod(p+n-1)10+1
b i=(1,1):[(p#(n*0^e),q#(n*e))|n<-[1+i..],let(p,q)=b i!!(n-1-i);e=mod n 2]
a=z uncurry o.b
o=(+):(-):(*):o
z=zipWith

Usage:
(zipWith(+)(a 1)$a 0)!!5

Try it online!
Explanation:
The # operator is for incrementing a coordinate by some value n and wrapping it. Notice the -1 and +1 to get it onto the range [0..9] so mod will work right.
The b function builds an infinite list of coordinates given an offset value of 0 or 1 to simulate the difference between 0 indexing and 1 indexing. b works by recursively iterating on the coordinates, starting with a hardcoded value of (1,1). When updating a coordinate we need to make sure we don't change it if n doesn't have the right parity so I multiply n by some value that will be 0 or 1 depending on its parity. e will be 0 when n is even and 1 otherwise and the 0^ trick can invert that for the other case.
The a function also takes an offset, passes it to b and zips the result with an infinite list cycling between the addition, subtraction and multiplication operators. The zip is performed with the uncurry function which breaks up the coordinate pair and applies them to the operator.
Finally we build the resulting sequence by simply zipping the lists (generated with different offsets) with the addition operator. Then we use the (!!) operator to turn it into a lookup function.

Nice answer, +1 from me. Could you perhaps add a Try It Online link? Haskell should also be among the available TIO programming languages.

Defining z=zipWith and o=(+):(-):(*):o saves some bytes: Try it online! (I also added a command line flag to be able to define s in the header section.)

Also your current byte count seems of, it should be 159 bytes.

Python 2, 85 bytes
lambda j:ord('!/0~3)*630$+$H9M.(+M:L))*"):8+).z9/$('[j%60])-29

Try it online!
Based off of ovs' Python 3 answer; implemented in Python 2 without using non-ASCII characters.

Java 8, 191 85 bytes
n->"HEVWD¥Z;PQ:]Z;¦WDKR;FKDo`;tU:OR;taDsPEPQDIPE¦a:_R;PU:¡`EVK:O".charAt(n%60)-68

-106 bytes by porting @ovs' Python 3 answer.
I lost my initial solution that I've used to create the test cases.. :( But the hard-coded result is way shorter anyway.
I didn't knew the sequence was repeating every 60 items until after I posted the challenge. ;)
Try it online.


text:
Elliptic system
Introduction
Given five points in the plane, your task is to compute the area of the ellipse passing through these points.
You can assume that exactly one non-degenerate ellipse can be constructed with the given input values.
Rules
Input is 10 integers in any convenient form, corresponding to the x and y coordinates of the points. For example, you could take input as a list of 10 integers [x1, y1, x2, y2, ..., x5, y5], or as [[x1, y1], [x2, y2], ..., [x5, y5]], etc.. You may also handle decimal numbers, but only integers are required.
Output is a representation of the area of the ellipse. This may be some symbolic expression, or a decimal value with at least 8 digits of precision.
This is code-golf, so the shortest answer in bytes wins.
Example Input and Output
Input:

[-2, 3, 2, 5, 5, 3, 4, 0, 1, -3]

Output:

62.15326783788685

A depiction of the ellipse passing through these points:

More examples:
f(60, -92, -31, -10, 78, -19, -27, -35, 91, -37) = 9882.59540465108
f(-9, -4, 7, 7, 10, 1, -7, -10, 0, 7) = 269.5966648188643
f(-3, 2, 0, -5, 4, 0, -4, 1, -1, 2) = 98.54937293879908

Was this by any chance inspired by this SPOJ problem? http://www.spoj.com/problems/ELLIPSE/

It was not. I am not active on that site.

What does it mean that the output may be a symbolic expression?

@xnor Perhaps an (unevaluated) elliptic integral?

@xnor I think it means that it can be an exact answer, if the language supports it.

Annnnd the best tool for the job goes tooooooo: Mathematics graphing programs! Go figure :P.

Mathematica, 87 80 78 bytes
Area@ImplicitRegion[+##Sign@#&@@Det[{1,##,1##,#^2,#2^2}&@@@{x|y,##}]>0,{x,y}]&

Takes 5 inputs: [{x1, y1}, ... , {x5, y5}].
Returns an exact/symbolic value.
How?
Let f(x, y) denote the vector (1, x, y, xy, x^2, y^2) for some x, y.
Then, the determinant of the matrix with row vectors [f(x, y), f(x1, y1), f(x2, y2), ..., f(x5, y5)] is zero iff (x, y) is a point on the ellipse we are looking for. i.e. the determinant gives the expression for the ellipse.
Since the sign of the expression might be inverted, we take the constant term and multiply the entire expression by the sign of the constant. That way, we can set the expression greater than 0 to find the area.

+1. I like how you fixed an issue with Sign.

MATLAB, 130 124 114 bytes
The input is takean as two column vectors, one for the x- and one for the y-coordinates. This method uses a least sequares regression, which provides the exact ellipse if all points are exactly on an ellipse, and then applies the formula provided here (thanks @orlp) to calculate the area.
function A=f(x,y);p=null([x.^2,2*x.*y,y.^2,2*x,2*y,0*x+1]);A=pi*det(p([1,2,4;2,3,5;4:6]))/abs(p(1)*p(3)-p(2)^2)^1.5

By appending following lines you can even plot the curve:
X=x;Y=y;
[x,y] = meshgrid(linspace(-7,7,50));
W = [x(:).^2,2*x(:).*y(:),y(:).^2,2*x(:),2*y(:),0*x(:)+1];
Z=x;Z(:) = W*p;
clf;plot(X,Y,'o');hold on;contour(x,y,Z,[0,0]);

Try it online!

Mathematica 84 Bytes
I found this to be an interesting problem.  Every ellipse is an affine transformation of the unit circle which can be parameterized as {x,y}={Cos(t),Sin(t)}, so the points on the circle can be mapped to the ellipse by {xE,yE}=A{x,y}+B where A is a constant matrix and B a vector.  Plugging in the points yields 10 scalar equations and 11 scalar unknowns, but we can decide that the parameterization starts at t=0, so the system is solvable. The absolute value of the determinant of the matrix A is the ratio of the area of the ellipse to the unit circle so we multiply by Pi.  Taking Max gets rid of the negative solution.
Max[π(a d-b c)/.Solve@MapThread[#2=={e,f}+{a,b}Cos@#+{c,d}Sin@#&,{{0,u,v,w,x},#}]]&

Usage:
%@{{-2, 3}, {2, 5}, {5, 3}, {4, 0}, {1, -3}}

Yields:
(1001 π)/(16 Sqrt[10])

Mathematica, 144 bytes
x_±y_:=x^2a+b*x*y+y^2c+d*x+e*y+f;n=∞;Integrate[UnitStep[x±y/.FindInstance[And@@(#±#2==0&@@@#),{a,b,c,d,e,f},Reals,2][[1]]],{x,-n,n},{y,-n,n}]&

works for all test cases
Input example: [{{-3, 2}, {0, -5}, {4, 0}, {-4, 1}, {-1, 2}}]
Results

9882.59540465108163146329
  269.596664818864334050934
  98.5493729387989852754258

-10 bytes from JungHwan Min
± is 1-byte in default windows encoding [CP-1252]

Hmm...why am I getting infinity on your input example?

@numbermaniac I don't know. I get it right. are you using this input [{{-3, 2}, {0, -5}, {4, 0}, {-4, 1}, {-1, 2}}]?

Yeah, I am - that's weird.

I am getting (3575880 π)/(2351 Sqrt[2351]) which is accepted as an answer

@numbermaniac maybe you should use ClearAll because there are too many vars used...

Weird, even ClearAll doesn't fix it. Oh well, don't worry about it haha. As long as it works for you. What version of Mathematica are you on?

Desmos, 101 bytes
u
v
f(a,b,c,h,k,x,y)=(((x-h)cosc+(y-k)sinc)/a)^2+(((x-h)sinc-(y-k)cosc)/b)^2
f(m,n,o,p,q,u,v)~1
mn\pi

Online Desmos doesn't like multiline pastes, so you have to enter it in one line at a time, or
Try It Online!
Input is taken with the two lists u and v. The output is shown on the last line.
Explanation:

The first two lines name the input variables.
The third line defines the equation for any ellipse, with radii a and b, rotation angle c, and offset (h,k).

Prettified, it looks like this:

The fourth line calculates a regression of f over the lists u and v, finding radii m and n, rotation angle o, and offset (p,q).
The last line calculates the area of the ellipse with the formula A = pi*r1*r2

You can also Try It Online (different link) for a slightly expanded, interactive visual version. You can move around the five points and view the ellipse and area in real time:

Alternatively, here is a slightly longer solution using this formula (same as @flawr's answer):
Desmos, 106 bytes
u
v
f(A,B,C,D,E,F,x,y)=Axx+2Bxy+Cyy+2Dx+2Ey+F
f(G,H,I,J,K,L,u,v)~0
\pi(GIL+2HJK-JJK-GKK-HHL)/(GI-HH)^{1.5}

Try It Online!

You might not need the backslash there before pi on the last line: if I type in mnpi, the pi symbol still shows up. Also, do you mean "the output is shown on the last line", not input?

@numbermaniac I'm putting in the backslash because when I copy-paste it in, it doesn't recognize mnpi, even though it words when I type it out. And yes, I meant output, not input, thanks.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Narcissistic array elements
Definition
Narcissistic 1 integers of an array think they are better than their neighbours, because they are strictly higher than their arithmetic mean.
Neighbours are defined as follows:

If the integer is at index 0 (the first), then its neighbours are the last and the second elements of the list.

If the integer is not the first nor the last, then its neighbours are the two immediately adjacent elements.

If the integer is at index -1 (the last), then its neighbours are the second-last and the first elements of the list.

Task
Given an array of integers, your task is to discard the narcissistic ones.

The integers can be positive, negative or zero.

You may assume that the array contains at least three elements.

All standard rules apply. This is code-golf, so the shortest code in bytes wins.

Examples
Consider the array [6, 9, 4, 10, 16, 18, 13]. Then we can built the following table:

Element | Neighbours | Neighbours' Mean | Is Narcissistic?
--------+------------+------------------+-----------------
6       | 13, 9      | 11               | False.
9       | 6, 4       | 5                | True.
4       | 9, 10      | 9.5              | False.
10      | 4, 16      | 10               | False.
16      | 10, 18     | 14               | True.
18      | 16, 13     | 14.5             | True.
13      | 18, 6      | 12               | True.

By filtering the Narcissistic ones out, we are left with [6, 4, 10]. And that's it!
Test Cases

Input -> Output

[5, -8, -9]                         -> [-8, -9]
[8, 8, 8, 8]                        -> [8, 8, 8, 8]
[11, 6, 9, 10]                      -> [6, 10]
[1, 2, 0, 1, 2]                     -> [1, 0, 1]
[6, 9, 4, 10, 16, 18, 13]           -> [6, 4, 10]
[6, -5, 3, -4, 38, 29, 82, -44, 12] -> [-5, -4, 29, -44]

 1 - Narcissist does not mean mathematically Narcissistic.

Jelly, 10 bytes
ṙ2+ṙ-<ḤCx@

Try it online!
Explanation:
ṙ2+ṙ-<ḤCx@
ṙ2         Rotate the original list two elements to the left
  +        Add each element to the respective element of the original list
   ṙ-      Rotate the result one element to the right
     <Ḥ    Check if each element is less than the double of its respective element on the original list
       C   Subtract each 1/0 boolean from 1 (logical NOT in this case)
        x@ Repeat each element of the original list as many times as the respective element of the logical NOT (i.e. keep elements of the original list where the respective element from the result is 1)

JavaScript (ES6), 57 56 bytes
a=>a.filter((e,i)=>e+e<=a[(i||l)-1]+a[++i%l],l=a.length)

Edit: Saved 1 byte thanks to @g00glen00b.

Python 2, 60 bytes
lambda x:[b for a,b,c in zip(x[-1:]+x,x,x[1:]+x)if b*2<=a+c]

Try it online!

05AB1E, 22 17 15 14 bytes
vy¹®1‚N+èO;>‹—

Try it online!
vy             # For each...
  ¹            # Push array.
   ®1‚         # Push [1,-1]
      N+       # Add current index.
        è      # Push surrounding values of current index.
         O;    # Summed in half.
           >‹  # A <= B?
             — # If true, print current.

Save 1 byte with ʒ¹®1‚¾+èO;>‹¼

Mathematica, 44 bytes
Pick[#,#<=0&/@(2#-(r=RotateLeft)@#-#~r~-1)]&

How it works
Given input such as {11,6,9,10}, computes
2*{11,6,9,10} - {6,9,10,11} - {10,11,6,9}

and picks out the elements of the original input in places where this result is at most 0.

Octave / MATLAB, 48 bytes
@(x)x(conv([x(end),x,x(1)],[1,-2,1],'valid')>=0)

Try it online!
Explanation
The input array is first extended with the last (x(end)) and first (x(1)) entries at the appropriate sides.
The test for narcissism is done by convolving the extended array with [1, -2, 1] and keeping only the 'valid' part.
Comparing each entry in the convolution result with 0 gives a logical index (mask) which is used to select the numbers from the input.

Haskell, 51 bytes
f s=[b|(a,b,c)<-zip3(last s:s)s$tail$s++s,b*2<=a+c]

Try it online! Usage example: f [1,2,3] yields [1,2].
For s = [1,2,3], last s:s is the list [3,1,2,3] and tail$s++s the list [2,3,1,2,3]. zip3 generates a list of triples (a,b,c) from three given list, truncating the longer ones to the length of he shortest list. We get [(3,1,2),(1,2,3),(2,3,1)], with b being the original list element and a and c its neighbours. The list comprehension then selects all b where b*2<=a+c, that is b is not narcissistic.

Japt, 17 16 15 bytes
kÈ>½*[Y°ÉY]x!gU

Try it

Explanation
Implicit input of array U.
kÈ>

Remove (k) the elements that return true when passed through a function, with Y being the current index, that check if the current element is greater then ...
[Y°ÉY]

The array [Y-1, Y+1] ...
x!gU

Reduced by addition (x) after indexing each element into U ...
½*

Multiplied by .5.

Alternative, 15 bytes
fÈ+X§UgYÉ +UgYÄ

Try it

R, 51 56 bytes
Thanks to user2390246 for correcting my algorithm
function(l)l[c(l[-1],l[1])+c(l[s<-sum(l|1)],l[-s])>=2*l]

Try it online!
indexes l where c(l[-1],l[1])+c(l[s],l[-s]), the neighbor-sums of l, are not less than twice l.

Mathematica, 40 bytes
Pick[#,+##>=3#2&@@@Partition[#,3,1,-2]]&

I think you need <= instead of <.

Actually no, you'll need >=.

@MartinEnder Ah, you're right. I have to Pick non-narcissistic numbers.

J, 16 bytes
#~+:<:1&|.+_1&|.

Try it online!
Explanation
#~+:<:1&|.+_1&|.  Input: array A
           _1&|.  Rotate A right by 1
      1&|.        Rotate A left by 1
          +       Add
  +:              Double each in A
    <:            Less than or equal to
#~                Copy the true values from A

Python 2, 64 60 bytes

Saved four bytes thanks to xnor; golfing l[-~j%len(l)] (and a space) to (l+l)[-~j].

lambda l:[k for j,k in enumerate(l)if(l+l)[-~j]+l[~-j]>=k+k]

Try it online!

Jelly, 17 bytes
Ḣ+ṪH<ḢṆ
.ịj⁸Ç3ƤTị

Try it online!

Java 8, 141 137 127 bytes
import java.util.*;a->{List r=new Stack();for(int i=0,l=a.length;i<l;)if(2*a[i]<=a[(i-1+l)%l]+a[++i%l])r.add(a[i-1]);return r;}

-10 bytes thanks to @Nevay.
Explanation:
Try it here.
import java.util.*;    // Required import for List and Stack

a->{                   // Method with integer-array parameter and List return-type
  List r=new Stack();  //  Return-list
  for(int i=0,         //  Index integer, starting at 0
      l=a.length;      //  Length of the input array
      i<l;)            //  Loop over the input array
    if(2*a[i]<=        //   If two times the current item is smaller or equal to:
        a[(i-1+l)%l]   //   The previous integer in the list
        +a[++i%l])     //   + the next integer in the list
      r.add(a[i-1]);   //    Add the current integer to the result-list
                       //  End of loop (implicit / single-line body)
  return r;            //  Return result-List
}                      // End of method

Julia 0.6, 38 bytes
!x=x[x[[e=end;1:e-1]]+x[[2:e;1]].>=2x]

Try it online!

JavaScript ES5 , 59 bytes

F=a=>a.filter((x,i)=>2*x<=a[-~i%(l=a.length)]+a[(i-1+l)%l])

console.log(""+F([5, -8, -9])==""+[-8, -9])
console.log(""+F([8, 8, 8, 8])==""+[8, 8, 8, 8])
console.log(""+F([11, 6, 9, 10])==""+[6, 10])
console.log(""+F([1, 2, 0, 1, 2])==""+[1, 0, 1])
console.log(""+F([6, 9, 4, 10, 16, 18, 13])==""+[6, 4, 10])
console.log(""+F([6, -5, 3, -4, 38, 29, 82, -44, 12])==""+[-5, -4, 29, -44])

Perl 5, 51 + 1 (-a) = 52 bytes
$p=$F[-1];say map{$p+$F[++$i%@F]<2*($p=$_)?'':$_}@F

Try it online!

PowerShell, 75 bytes
for($i=0;$i-lt$a.Length;$i++){if($a[$i]-le(($a[$i-1]+$a[$i+1])/2)){$a[$i]}}

APL, 20 bytes
{⍵/⍨⍵≤2÷⍨(1⌽⍵)+¯1⌽⍵}

Try it online!


text:
Like a path-segment; touched for the very first time
Given an ordered list of 2 or more 2D cartesian points, output a truthy value if either the path touches itself or self-intersects; otherwise output a falsy value if it does not touch itself or self-intersect.
You may assume that consecutive points in the list are distinct.
Examples:
(0,0), (1,0) -> falsey
(0,0), (1,0), (0,0) -> truthy
(0,0), (1,0), (1,1), (0,0) -> truthy
(0,0), (2,0), (1,1), (1,-1) -> truthy
(0,0), (10,0), (0,1), (10,1), (0,2), (10,2) -> falsey

Note all the co-ordinates I gave here are integers.  You may support co-ordinate inputs of whatever you like out of {integer, decimal, rational, floating-point, ...}.  But your implementations calculations must give the correct answers for any inputs given.

what a good title A+

Initial scene of Reservoir Dogs, anyone?

Forgive me if I'm misunderstanding but how is the last test case non-intersecting? https://i.imgur.com/wiNMByd.png

@icrieverytim It is not a closed walk. The last point does not connect to the first.

Python 2, 315 309 298 382 380 372 bytes
s=sorted
w=lambda(x,y),(X,Y),(z,w):(X-x)*(w-y)-(z-x)*(Y-y)
def I(a,b):p,q=s(a);P,Q=s(b);n,N,m,M=w(p,q,P),w(p,q,Q),w(P,Q,p),w(P,Q,q);return(q>=P)*(Q>=p)if{n,N,m,M}=={0}else(b[1]!=a[0])*(n*N<=0>=m*M)
def f(l):
 i=0
 while i<len(l)-2:
	x=l[i:i+3];i+=1
	if w(*x)==0and s(x)==x:l.pop(i);i-=1
 L=zip(l,l[1:]);return any(I(*l)for l in[(k,x)for i,k in enumerate(L)for x in L[:i]])

Try it online!
Uses the algorithm from here, combined with this SO answer for collinear segments.
Edit: Fixed for line segments continuing in the same direction (eg (0,0),(1,0),(2,0)) by removing the middle point, (resulting in (0,0),(2,0)).

You can save two bytes by replacing all two occurrences of two spaces with a single tab.

*((n*N>0)+(m*M>0)<1) -> *(n*N<=0>=m*M).

Eukleides, 154 148 bytes
number i (set p)
g=card(p);h=g;n=0;e=p[0];q=e.e
for d in p
if h<g-1
q=q.e
n=card(intersection(d.e,q))>1or d on q?1|n
end
e=d;h=h-1
end;return n;end

Function named i that, passed a set of points, returns 0 or 1. Semicolons and line breaks are interchangeable for ending a command, I just lumped a few things together for the sake of keeping the code visibly short since we're not used to legible code around here anyway.
Eukleides is a plane geometry language primarily for graphical output, but with decent programmatic abilities as well. I thought it'd be great for this task, but a few things frustrated me. First, it's worth noting that sets in Eukleides are essentially arrays of points, and when applicable are rendered out as paths made of connected line segments. Eukleides supports the iterative generation of sets via loci, akin to a for-loop that creates a set in the process. Had I been able to use a locus, it would have shaved off bytes, but apparently Eukleides doesn't like to reference a partially-formed locus from within itself.
The other major frustration was that if, seemingly, two identical line segments are on top of each other, intersection only returns one offending point (which makes sense, I suppose, there would be infinite intersections). My method is essentially to build up the path one step behind, and test the next line segment for intersections with the path. Because of the aforementioned intersection behavior I check separately for whether or not the point is on the path.
Edit: Cut off 1 byte by reordering the or statement to allow for the removal of a space before or; 5 more bytes by changing that if block into a ternary operation.
Test cases:
ta=point(0,0).point(1,0)
tb=point(0,0).point(1,0).point(0,0)
tc=point(0,0).point(1,0).point(1,1).point(0,0)
td=point(0,0).point(2,0).point(1,1).point(1,-1)
te=point(0,0).point(10,0).point(0,1).point(10,1).point(0,2).point(10,2)
print i(ta);print i(tb);print i(tc);print i(td);print i(te)

0
1
1
1
0


text:
A Slashy Dashy Spiral
Given a positive integer N, output the innermost N×N square of an ASCII art spiral made of -|/\ that spirals clockwise inward.
The - is used for horizontal portions, | for vertical portions, and / and \ for corners. The first character is - and the spiral proceeds left and down.
Specifically, when N is 1 the output is:
-

When N is 2 the output is:
/-
\-

When N is 3 the output is:
--\
/-|
\-/

When N is 4 the output is:
 /--\
 |/-|
 |\-/
 \---

Note how every output is a square of N by N characters.
The pattern continues in the same way:
N=1
-

N=2
/-
\-

N=3
--\
/-|
\-/

N=4
/--\
|/-|
|\-/
\---

N=5
----\
/--\|
|/-||
|\-/|
\---/

N=6
/----\
|/--\|
||/-||
||\-/|
|\---/
\-----

N=7
------\
/----\|
|/--\||
||/-|||
||\-/||
|\---/|
\-----/

N=8
/------\
|/----\|
||/--\||
|||/-|||
|||\-/||
||\---/|
|\-----/
\-------

etc.

The shortest code in bytes wins.

Charcoal, 17 16 bytes:
↶⁴-Ｆ⊖Ｎ«↶²/ι↶²\-ι

Try it online! Link is to verbose version of code.
↷²-¶Ｆ⊖Ｎ«/ι↶²\-ι↶

Try it online! Link is to verbose version of code.
Edit: Saved 1 byte thanks to @icrieverytim.

Aw shoot, I got ninja'd. ;-; Anyways, 16 bytes.

@icrieverytim Oh, I forgot about Decremented, it's too new.

Neil are you the creator of Charcoal?

@Jonah ASCII-only, along with DLosc, created Charcoal.

Python 2, 148 134 bytes
f=lambda n,J=''.join:n<2and['-']or n%2and['-'*~-n+'\\']+map(J,zip(f(n-1),'|'*(n-2)+'/'))or map(J,zip('/'+'|'*n,f(n-1)))+['\\'+'-'*~-n]

Try it online!


text:
Prime Factoral Roots
Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is thus its own prime factoral root).  The prime factoral root of 4 is 4, as 2*2=2+2, and this is the only non-prime prime factoral root of an integer greater than 1 (which is another special case, as it has no prime factors).  The OEIS sequence formed by prime factoral roots is A029908.
For example, the prime factoral root of 24 is:
24=2*2*2*3

2+2+2+3=9=3*3

3+3=6=2*3

2+3=5, and the only prime factor of 5 is 5.  Therefore, the prime factoral root of 24 is 5.

Your Task:
Write a program or function that finds the prime factoral root of an input integer.
Input:
An integer, input through any reasonable method, between 2 and the largest integer your language will support (inclusive).  Specifically choosing a language that has an unreasonably low maximum integer size is not allowed (and also violates this standard loophole)
Output:
An integer, the prime factoral root of the input.
Test Cases:
4   -> 4
24  -> 5
11  -> 11
250 -> 17

Scoring:
This is code-golf, lowest score in bytes wins!

Can you add 4 in the test cases, since it's an exception and it's easy to forget about it while testing an answer?

Do we have to output 1 for 1?

@someone according to the linked OEIS sequence, it should output 0 for 1

@someone The challenge states that the input will be at least 2.

@someone Sorry for being off for a while. As Martin said, the challenge specifically says that the input will be greater than one, and therefore behavior when the input is 1 is undefined.

The name of this challenge seems like someone just took a bunch of random math terms and shoved them together.

I know.  It makes sense when you read the question, but not really before that.

Haskell, 61 bytes
import Data.Numbers.Primes
until=<<((==)=<<)$sum.primeFactors

Try it online!
Explanation
until=<<((==)=<<) takes a function f and applies it to input x until a fix point is reached, that is f x equals x. primeFactors returns the list of prime factors of a number, sum yields the sum of a list of numbers.
But wait, why does until=<<((==)=<<) the job and looks so weird?
If we assume f=sum.primeFactors, a more natural definition  would be until(\x->f x==x)f, because until takes a predicate (a function which returns a boolean), a function which has the same input and return type (e.g. Int -> Int) and value of this type, and then applies the function to the value until the predicate is fulfilled.
until(\x->f x==x)f is the same as until(\x->(==)(f x)x)f, and as it holds that g (h x) x is the same as (g=<<h)x, we get until(\x->((==)=<<f)x)f. After Eta conversion, this becomes until((==)=<<f)f. But if we now treat (==)=<< as a function which is applied to f, we can see that until(((==)=<<)f)f is again of the form g (h x) x, with g=until, h=((==)=<<) and x=f, so it can be rewritten to (until=<<((==)=<<))f. Using the $ operator to get rid of the outer parentheses and substituting f with sum.primeFactors yields the solution from above.

=<<((==)=<<)$ Whaaaaaat.

@icrieverytim I added an explanation. Feel free to ask in the Haskell chat room if you have further questions on how this sorcery works.

05AB1E, 3 bytes
FÒO

Try it online!
Explanations:
FÒO
F    Loops <input> times + 1
 Ò   List of prime factors w/ duplicates
  O  Total sum of the list
     -- implicit output

This seems to fail for 4.

@Shaggy fixed while saving 2 bytes

Does this make anyone trying to beat this a FÒO-fighter?

At least it wasn't FOObar.

Husk, 4 bytes
ω(Σp

Try it online!
Explanation:
ω(   -- apply the following function until the result no longer changes (fixpoint)
  Σ  -- sum
   p -- the list of primefactors

Pyth, 3 bytes
usP

Try it here.
Explanation:
usPGQ The trailing GQ is implicit
  PG  Get prime factors
 s    Sum
u   Q Repeat until returned value no longer unique starting with the input

Did you forget to update your explanation?

@MCMastery No, the code and the explanation are the same. The trailing GQ is implicit

@MCMastery what i cri everytim said

Java 8, 175 144 142 141 139 101 bytes
n->{for(int i=n;i-->0;)n=f(n,2);return n;};int f(int n,int d){return n>1?n%d<1?f(n/d,2)+d:f(n,d+1):0;}

-38 bytes porting @ovs' Python answer, so make sure to upvote him as well!
Try it online.
n->{                 // Method with integer as both parameter and return-type
  for(int i=n;i-->0;)//  Loop the input `n` amount of times:
    n=f(n,2);        //   Change `n` that many times by calling the recursive method
                     //   with n,2 as parameters
  return n;}         //  Then return the potentially modified `n` as result

int f(int n,int d){  // Separated method with 2 integer parameters & integer return
                     // (`d` is 2 when we initially call this recursive-method)
  return n>1?        //  If input `n` is larger than 1:
          n%d<1?     //   If `n` is divisible by `d`:
           f(n/d     //    Divide `n` by `d`
             ,2)     //    Do a recursive call with n/d,2 as parameters
                +d   //    And add `d` to its result
          :          //   Else:
           f(n,d+1)  //    Do a recursive-call with the next `d` by using n,d+1 as
                     //    parameters
         :           //  Else:
          0;}        //   Simply return 0

Original 175 144 142 141 139 bytes answer:
n->{for(int i,t=n,x;;n=t){for(i=2;i<t;)t=t%i++<1?0:t;if(t>1|n<5)return n;for(t=0,i=1;i++<n;)for(;n%i<1;t+=x)for(n/=x=i;x>9;x/=10)t+=x%10;}}

-1 byte thanks to @Nevay
-2 bytes thanks to @ceilingcat
Explanation:
Try it online.
n->{                 // Method with integer as both parameter and return-type
  for(int i,         //  Index-integer `i`
          t=n,       //  Temp integer `t`, starting at the input `n`
          x;         //  Temp integer `x`
      ;              //  Loop indefinitely:
      n=t){          //    After every iteration, replace `n` with the value `t`
    for(i=2;i<t;)    //   Inner loop `i` in the range [2,t):
      t=t%i++<1?     //    If `t` is divisible by `i`:
         0           //     Set `t` to 0
        :            //    Else:
         t;          //     Leave `t` the same
    if(t>1           //   If `t` is not 0 or 1 (it means it's a prime),
       |n<5)         //   or if `n` is below 5 (for edge-cases n=1 and n=4)
      return n;      //    Return `n` as result
    for(t=0,         //   Reset `t` to 0
        i=1;         //   Reset `i` to 1
        i++<n;)      //   Inner loop `i` in the range (2,n]:
      for(;n%i<1;    //    Inner loop as long as `n` is divisible by `i`:
          t+=x)      //      After every iteration: Increase `t` by `x`
        for(n/=x=i;  //     Reset `x` to `i`
                     //     And divide `n` by `i`
            x>9;     //     Inner loop as long as `x` contains more than 1 digit:
            x/=10)   //       After every iteration, remove the trailing digit of `x`
          t+=x%10;}} //      Increase `t` with the trailing digit of `x`

+1 for bothering to write an explanation as verbose as if this was a golfing language.

@someone Thanks! Since someone asked me about an explanation of a Java answer of mine once in the past, I've been adding them to all my answers. :)

i,t=n,x looks like it belongs in Python, haha

@ETHproductions Hehe, too bad I still have to add the leading int  (unlike Python). ;)

You can use i++<n instead of ++i<=n.

Why are you summing digits of some number?

Python 2, 84 bytes
f=lambda n,d=2:n>1and(n%d and f(n,d+1)or d+f(n/d))
i=input()
exec'i=f(i);'*i
print i

Try it online!

This may be a pretty dumb question, but how does f=lambda n,d=2:n>1and(n%d and f(n,d+1)or d+f(n/d)) work? I've never programmed in Python (mainly Java and C#), so I'm unsure what the result of this function is. Does this function modify the input n and return it afterwards, or is it similar to a boolean where n>1and(n%d and f(n,d+1)or d+f(n/d)) is either 0 or 1, or 0 or n, or something else? I'm trying to visualize how a port of this would look like in Java/C#, but I'm unable to because I don't really understand Python lambdas like this in general.

@KevinCruijssen this is equivalent to n>1 ? (n%d!=0 ? f(n, d+1) : d+f(n/d)) : n>1. In general terms x and y is equivalent to x ? y : x. x and y or z is equivalent to x ? y : z in most cases.

@KevinCruijssen a Java port would be something like f=(n,d=2)->n>1?n%d>0?f(n,d+1):d+f(n/d):0.

Ah ok. Thanks for the explanation, now it makes a lot more sense. And I remember x and y being x ? y : x from JavaScript as well. Thanks!

Retina, 30 bytes
{+`(\1|\b11+?\B)+$
$1;$#1$*
;

Input and output in unary.
Try it online! (Performs decimal/unary conversion for convenience.)
Explanation
{+`(\1|\b11+?\B)+$
$1;$#1$*

The { instructs Retina to run the entire program in a loop until a full pass fails to modify the string, i.e. until a fixed point is reached. Consequently, the program itself computes one step of summing the prime factors of the current value.
This stage itself computes the prime factorisation of the input. The + is similar to { but loops only this stage until it stops changing the string. The regex tries to match the final run of 1s by repeatedly matching the same substring (i.e. the factor). The way this is done is a bit convoluted due to the forward reference \1. On the first iteration, group 1 hasn't captured anything yet, so \1 fails unconditionally. Instead, we have to match \b11+?\B which is the smallest possible substring that starts at the beginning of the run, contains at least two 1s and doesn't cover the entire run. Subsequent iterations will not be able to use this alternative again, due to the \b. So on all further iterations, we're matching \1, i.e. the same substring over and over again. This process has to hit the end of the string exactly ($) to make sure we've captured and actual divisor. The benefit of using this somewhat tricky approach is that group 1 will have been used exactly n/d times, i.e. what remains after dividing out the divisor d.
We replace this match with d ($1), a separating ; and n/d ($#1$*, which inserts $#1 copies of 1, where $#1 is the number of captures made by group 1).
This process stops once the final run in the string is itself a prime, because then the regex no longer matches.
;

All we need to do to sum the primes is to remove all the separators.

Jelly, 5 bytes
ÆfS$¡

Explanations:
Æf    list of prime factors
  S   sum
   $¡ repeat n times

Try it online!

5 bytes

Ohm v2, 4 bytes
·ΘoΣ

Try it online!
Explanation:
·Θ    evaluate the block until the result returned has already been seen
   Σ  sum
  o   the full prime factorization

Actually, 7 bytes
⌠w♂πΣ⌡Y

Try it online!
Explanation:
⌠w♂πΣ⌡Y
⌠    ⌡Y  do this until output stops changing (fixed-point combinator)
 w         factor into [prime, exponent] pairs
  ♂π       product of each pair
    Σ      sum of products

R + pracma, 53 bytes
function(n){for(i in 1:n)n=sum(pracma::factors(n))
n}

Try it online! (r-fiddle)
R doesn't have a prime factors builtin, but numerous packages (pracma, numbers, etc.) do, so I picked a conveniently short one.

MATL, 6 bytes
Uses scottinet's idea of looping more times than needed. Thanks also to Shaggy for a pointing out a mistake, now corrected.
t:"Yfs

Try it online!
Explanation
t       % Take input (implicit). Duplicate
:"      % Do the following that many times
  Yf    %   Array of prime factors
  s     %   Sum of array
        % End (implicit). Display (implicit)

This seems to fail for 4.

@Shaggy Thanks! Working on that

@Shaggy Solved now

Jelly, 6 bytes
This answer uses one of Jelly's many prime factorization builtins, and the quick for repeat until the results are no longer unique.
ÆfSµÐL

Try it online!

I think you've been outgolfed but, given your approach, I'm uncertain whether that answer works

@cairdcoinheringaahing I've just checked his answer (or rather, the Python equivalent) from 1 to 100000 and it works. I think 1 is the only case where the number of steps needed is equal to n (which is fine; with 1 we only need to run it once), and there don't seem to be any cases where the number of steps is greater than n (i.e. there don't seem to be any counterexamples). Ah well, I've been outgolfed :D

Well, it happens. Although +1 for being the exact same code I thought of when I saw this challenge

The sum of prime factors of n is always less than or equal to n, which makes it pretty easy to prove that n is always more than enough.

PowerShell, 124 bytes
function f($a){for($i=2;$a-gt1){if(!($a%$i)){$i;$a/=$i}else{$i++}}}
for($x=$args[0];$l-ne$x){$l=$x;$x=(f($x))-join'+'|iex}$x

Try it online!
PowerShell doesn't have any prime factorization built-ins, so this uses code from my answer on Prime Factors Buddies (the top line) to perform the factorization calculations.
The second line is the meat of this program. We take input from $args into $x, then for loop until $l is -notequal to $x. (The first iteration, $l is $null and $x is an integer, so we'll loop at least once).
Inside the loop, we set our $l = $x to determine if we've hit the end of the loop or not. Then we get the factors of $x with f($x), -join those together with + and |iex them (short for Invoke-Expression and similar to eval). That's stored back into $x. Thus, we've hit the "end" where the prime factorization summed together is back to itself. Then, we simply place $x on the pipeline and output is implicit.

Mathematica, 35 bytes
#//.x_:>Tr[1##&@@@FactorInteger@x]&

Try it online!
(Mathics does not support Tr. I have to implement it manually)

1##& is short for Times and FixedPoint can almost always be shortened with //.: #//.x_:>Tr[1##&@@@FactorInteger@x]&

@MartinEnder Thanks! I should have already known about Times, but I've not known about the FixedPoint trick.

Your code is written in Mathematica. This is not a Mathics function. You should either change the language name to Mathematica or Tr to Total

@{no one} Sorry, language name (Mathics) was a mistake. {i cri evritime} fixed that.

FYI, I opened a PR to add Tr to Mathics a while back.

@Mego The current implementation wouldn't actually help here, because this (and most uses of Tr in code golf) relies on the generalisation to vectors.

Ruby, 63 bytes
->n{n.times{n=n.prime_division.map{|x|x.reduce:*}.sum};n}

Try it online!
Uses the -rprime flag for +6 bytes to make use of Prime#prime_division.
prime_division returns pairs of [prime, exponent] (for example, for 24 we have the factors [2, 2, 2, 3] so it gives [[2, 3], [3, 1]]) so in each step we just multiply the members of those pairs together and sum the results.

Javascript (ES6), 63 bytes

f=n=>(q=(p=(m,x)=>m<x?0:m%x?p(m,x+1):x+p(m/x,x))(n,2))^n?f(q):q
<input id=i type=number min=0 value=0 oninput="o.innerText=f(i.value)">

Ungolfed:
f=n=>(                  // Recursive function `f`
    p=(m,x=2)=>(        //   Recursive function `p`, used to sum prime factors
        m<x?            //     If m (the number to be factored) is less than x (the current
            0           //     iteration), return 0
        :m%x?           //     Else if m doesn't divide x
            p(m,x+1)    //     run the next iteration
        :               //     Else (if m divides x)
            x+p(m/x,x)  //     Divide m by x and repeat the current iteration
    ),
    q=p(n),             //   Set q to the sum of the prime factors of n
    q^n?                //   If q != n then
        f(q)            //     repeat f with q
    :                   //   else
        q               //     return q
)

Factor, 33 bytes
[ [ factors Σ ] to-fixed-point ]

Try it online!

to-fixed-point Apply a quotation to an object until it stops changing.
factors Σ Sum of prime factors.