Skip to main content
added WolframAlpha search
Source Link
Misha Lavrov
  • 5.3k
  • 13
  • 27

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.

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: 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.

I think I'll stop here.
Source Link
Misha Lavrov
  • 5.3k
  • 13
  • 27

Mathematica: 323323 294 bytes

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

How it works

For a book beginning with character codes a,b,c,d,e, computers (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 probably around halfhard to put a number on but is a huge part of the improvement from the old version 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: 323 bytes

Uncompress["1:eJxTTMoPSpvOwMBQzAIkfDKLSzKBNAMSIYPKBRMgtZm8qGJccNY0VAlZVC4fKlcFbh6CywHncsJZonCWEYiQgBvFimoeGhdMMKJymVG5GqhcAVQHsaD6jRdXkCAIE7gpOJU4wVliIIIHlxckUSXY4Z4Be4EJr1fRfCmP10ESqFwlLMGOCByERQiXogU7L6oLwCwDVIvQ3IcgtFC5LKhcNlzaEIEohksdG9xesKHSsHABAIzURug="][[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, computers 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.

Thanks to @numbermaniac for the list compression idea, which is probably around half the improvement from the old version 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: 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.

added new method
Source Link
Misha Lavrov
  • 5.3k
  • 13
  • 27

Mathematica, 548 435: 323 bytes

{1,1,1,1,1,2,3,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,6,6Uncompress["1:eJxTTMoPSpvOwMBQzAIkfDKLSzKBNAMSIYPKBRMgtZm8qGJccNY0VAlZVC4fKlcFbh6CywHncsJZonCWEYiQgBvFimoeGhdMMKJymVG5GqhcAVQHsaD6jRdXkCAIE7gpOJU4wVliIIIHlxckUSXY4Z4Be4EJr1fRfCmP10ESqFwlLMGOCByERQiXogU7L6oLwCwDVIvQ3IcgtFC5LKhcNlzaEIEohksdG9xesKHSsHABAIzURug="][[Mod[ToCharacterCode[StringTake[#<>#,5]].{6,71,8,9,10,10,12,12,13,13,13,14,14,16,16,16,21,21,22,22,24,24,24,25,27,28,28,29,31,31,34,36,36,40,425,483},50151,521]]]&

How it works

For a book beginning with character codes a,b,c,d,e, computers 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.

Thanks to @numbermaniac for the list compression idea, which is probably around half the improvement from the old version here.

Old version: Mathematica, 548 435 407 bytes

Join["111112333333344444455555666789"~(p=StringPartition)~1,66"1010121213131314141616162121222224242425272828293131343636404248505266"~p~2,150{"150"}[[Max@StringPosition["2jn3jnjduoaapimhgi2pe2tshbkjeonhntttzpn2toclsjnjmlhpiprtu1jn1pe1tsjmjlmt1toehiglimcmsnoaometrerzdnlecs2cihbwnhihshzcr1cimrarmsjhojds1kgrva2sujsalku2kglviatcmte1co1supordur2conmreosjbbeeegnijriiahpas",""<>#&@StringTake[#<>#][[Max@StringPosition["2jn3jnjduoaapimhgi2pe2tshbkjeonhntttzpn2toclsjnjmlhpiprtu1jn1pe1tsjmjlmt1toehiglimcmsnoaometrerzdnlecs2cihbwnhihshzcr1cimrarmsjhojds1kgrva2sujsalku2kglviatcmte1co1supordur2conmreosjbbeeegnijriiahpas",{""<>#&@Characters[#<>#][[{1},{3},{6}}]]]]]/3]]&

How it works

The only nontrivial thing happening here is that weWe convert each name name to characters 1, 3, and 6 of namename (e.g. leviticus becomes lvi, job becomes jbb) before looking it up.

But you have to start somewhereThe list we look things up in is slightly compressed by putting the 1-digit and the 2-digit chapter numbers together in strings.

-113 bytes: characters 1,3,6 are an improvement over characters 1,2,3,4,5. But I think that's as far as that idea goes.

Mathematica, 548 435 bytes

{1,1,1,1,1,2,3,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,6,6,6,7,8,9,10,10,12,12,13,13,13,14,14,16,16,16,21,21,22,22,24,24,24,25,27,28,28,29,31,31,34,36,36,40,42,48,50,52,66,150}[[Max@StringPosition["2jn3jnjduoaapimhgi2pe2tshbkjeonhntttzpn2toclsjnjmlhpiprtu1jn1pe1tsjmjlmt1toehiglimcmsnoaometrerzdnlecs2cihbwnhihshzcr1cimrarmsjhojds1kgrva2sujsalku2kglviatcmte1co1supordur2conmreosjbbeeegnijriiahpas",""<>#&@StringTake[#<>#,{{1},{3},{6}}]]/3]]&

How it works

The only nontrivial thing happening here is that 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.

But you have to start somewhere.

-113 bytes: characters 1,3,6 are an improvement over characters 1,2,3,4,5. But I think that's as far as that idea goes.

Mathematica: 323 bytes

Uncompress["1:eJxTTMoPSpvOwMBQzAIkfDKLSzKBNAMSIYPKBRMgtZm8qGJccNY0VAlZVC4fKlcFbh6CywHncsJZonCWEYiQgBvFimoeGhdMMKJymVG5GqhcAVQHsaD6jRdXkCAIE7gpOJU4wVliIIIHlxckUSXY4Z4Be4EJr1fRfCmP10ESqFwlLMGOCByERQiXogU7L6oLwCwDVIvQ3IcgtFC5LKhcNlzaEIEohksdG9xesKHSsHABAIzURug="][[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, computers 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.

Thanks to @numbermaniac for the list compression idea, which is probably around half the improvement from the old version 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.

used characters 1,3,6 instead.
Source Link
Misha Lavrov
  • 5.3k
  • 13
  • 27
Loading
Source Link
Misha Lavrov
  • 5.3k
  • 13
  • 27
Loading