Thursday, December 15, 2016

Goats and Amicable Numbers

Goats and Amicable Numbers

In this week’s parasha, we find Yaakov preparing for his encounter with his twin brother Esav in several ways. Among other preparations, Yaakov sends him gifts consisting of various different kinds of animals. The Torah tells us (Bereishit 32:14–16) how many of each kind of animal Yaakov sent: 200 female goats and 20 male goats; 200 female sheep (ewes) and 20 male sheep (rams); 30 nursing camels with their young; 40 female cows and 10 bulls; 20 female donkeys and 10 male donkeys. What is the significance of these numbers?

In his ספר בעלי ברית אברם, R’ Avraham Azulai provides an explanation for the number of goats, which he attributes to R’ Nachshon Gaon of the 9th century. The total number of goats is 200 + 20 = 220. What significant property does the number 220 have?

Consider the factors of 220, that is, numbers that multiply together to give the product 220. We can factor the number 220 in the following ways:
220 = 1 × 220
220 = 2 × 110
220 = 4 × 55
220 = 5 × 44
220 = 10 × 22
220 = 11 × 20
Now consider only the “proper factors” of 220 – that is, all the factors in the above list, excluding the number 220 itself – and add them up:
1 + 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44 + 55 + 110 = 284
So the proper factors of 220 add up to 284.
We now repeat the process, considering the factors of 284. We can factor the number 284 in the following ways:
284 = 1 × 284
284 = 2 × 142
284 = 4 × 71
Again, we consider only the proper factors of 284 – all the factors in the above list, excluding the number 284 itself – and add them up:
1 + 2 + 4 + 71 + 142 = 220
So the proper factors of 284 add up to 220. Does this number look familiar?

As we have just shown, the numbers 220 and 284 have the property that the proper factors of each number add up to the other number. A pair of numbers with this property is known as a pair of amicable numbers, or according to R’ Nachshon Gaon, מנין נאהב. Apparently it was known to the ancients that in order to gain the love of kings and princes, a person would give one of a pair of amicable numbers as a present, keeping the other number for himself. This is so that the factors of the number given add up to the number kept, and the factors of the number kept add up to the number given. So this is what Yaakov did. He sent Esav 220 goats, and kept 284 for himself.

Wait a minute: The Torah tells us that Yaakov gave Esav 220 goats, but where do we see in the Torah that he kept 284 for himself? Several pesukim later, as Yaakov gives instructions to the servants carrying the gifts, the Torah records (32:21), “כי־אמר אכפרה פניו במנחה ההולכת לפני” – “for he said: I will win him over with the gifts that are being sent ahead.” R’ Nachshon Gaon explains that this sentence contains a hint to the number 284, in the following way. The word אכפרה can be divided in two parts: אכ פרה. When the Torah uses the word אך, it is generally interpreted by the Rabbis to indicate exclusion or reduction. Calculating the numerical value of the second part of the word, פרה, we get: 80 (פ‎) + 200 (ר‎) + 5 (ה‎) = 285. Applying a reduction (indicated by אך) to the value 285 (given by פרה), we obtain a value of 284. This represents the number of goats that Yaakov kept for himself, according to R’ Nachshon Gaon.

Special thanks to Daniel Levenstein for bringing this insight to my attention.


Leonard Eugene Dickson, History of the Theory of Numbers, Volume I: Divisibility and Primality, Carnegie Institute of Washington: Washington, 1919, p. 39, available at:

ר' אברהם ב"ר מרדכי אזולאי, ספר בעלי ברית אברם, published 1873 but existed in manuscript for 300 years previously; pp. 48–49, available beginning at:

הנאהבים והנעימים - על רעות אצל מספרים, in Michlalah Jerusalem College's mathematical journal אלף אפס (ℵ₀):
(may not work in all browsers)
(Thanks to Yaaqov Loewinger for this link via Hebrew Wikipedia)

Monday, April 25, 2016

Omer Counting in Different Bases

My father-in-law showed me a ספר that discusses whether or not you can fulfill your obligation to count the עומר using other base systems besides decimal. This a good case where the question is far more interesting than the answer. Surely, one should not do that. However, it was a very interesting concept I had never thought of before. So, I added a widget on the blog's sidebar which will display the day of the Omer in various relevant bases.

On the insistence of reader Pi (that's his shorter name), I have added base 7 as well as a pick-your-own-base section.
Here is the excerpt from the ספר.

Sunday, March 20, 2016

10,000 Kikars

Someone just sent me a brilliant piece explaining a very difficult תוספות regarding the 10,000 ככר of silver which המן gave for the extermination of the Jews. Check it out!

Friday, March 11, 2016

Frequency of חזק's and סיומי דפ יומי

This coming שבת, the סיום דף יומי מסכת גיטין coincides with the חזק of finishing ספר שמות. See this fascinating article by R' Dovid Heber of the Star-K. In it, he shows that since the beginning of דף יומי there have in fact been the same number of סיומים as חזק's and goes through the numbers to show exactly why that is. עיין שם,

I decided to take this matter a little further and investigate how many times this has actually happened or will happen, assuming the exact structure of דף יומי remains the same. This is what I found, going back to the beginning in 1923 all the way to the year 2050:

Beitzah 40 1/16/2044 16 Teves 5804 Vayechi
Avodah Zarah 76 7/7/2040 26 Tammuz 5800 Matos Masei
Moed Katan 29 7/14/2029 2 Av 5789 Matos Masei
Gitin 90 3/12/2016 2 Adar II 5776 Pekudei
Shabbos 157 3/9/2013 27 Adar 5773 Vayakhel Pekudei
Kesubos 112 12/22/2007 13 Teves 5768 Vayechi
Yevamos 122 12/24/1977 14 Teves 5738 Vayechi
Temurah 34 7/7/1945 26 Tammuz 5705 Matos Masei

It is interesting to note that it does not occur on בחוקתי at all in this time, nor does it ever land on שמחת תורה. In fact, looking even further ahead, the only time it will ever land on שמחת תורה between now and the year 2200 will be the following on שמחת תורה in ארץ ישראל:

Horiyos 14 Thu Oct 26, 2062 22 Tishrei, 5823
For anyone curious as to how I was able to figure all this out, I wrote a very short and simple Java application and made use of the brilliant Zmanim API by KosherJava.

And if you're even more curious, here's my code:

import java.util.Calendar;
import java.util.Date;

import net.sourceforge.zmanim.hebrewcalendar.HebrewDateFormatter;
import net.sourceforge.zmanim.hebrewcalendar.JewishCalendar;

public class Daf {

      public static void main(String[] args) {
            int daf;
            HebrewDateFormatter hdf = new HebrewDateFormatter();
            Calendar day = Calendar.getInstance();
            boolean siyum=false;
            // While loop to expose all siyumim that happen on Shabbos. I have to go in manually afterwards to identify the chazaks.
            // I could have possibly used getParshaIndex() and played with that to expose just the chazaks but that would have been clunkier
            while (day.get(Calendar.YEAR) > 1922){
                  JewishCalendar jewCal = new JewishCalendar(day);           
                      daf = jewCal.getDafYomiBavli().getDaf();
                  } catch (IllegalArgumentException iae){
                  if (siyum){
                        if (day.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY){
                        System.out.println(jewCal.getDafYomiBavli().getMasechtaTransliterated() + " " +
                                    daf + ", " + day.getTime() + "," +  jewCal + "," + jewCal.getParshaIndex());
                  if (daf == 2) siyum = true; //If today is the beginning of the masechta, yesterday was the siyum of the previous
                  day.add(Calendar.DAY_OF_YEAR, -1);
            //Separate loop to identify Simchas Torah since it isn't usually on Shabbos
            while (day.get(Calendar.YEAR) > 1922){
                  JewishCalendar jewCal = new JewishCalendar(day);           
                      daf = jewCal.getDafYomiBavli().getDaf();
                  } catch (IllegalArgumentException iae){
                  if (siyum){
                        // If the 22nd or 23rd day of Tishrei
                        if (jewCal.getJewishMonth() == 7 && (jewCal.getJewishDayOfMonth() == 22 || jewCal.getJewishDayOfMonth() == 23)){
                        System.out.println(jewCal.getDafYomiBavli().getMasechtaTransliterated() + " " +
                                    daf + ", " + day.getTime() + "," +  jewCal + "," + hdf.formatParsha(jewCal));
                  if (daf == 2) siyum = true;
                  day.add(Calendar.DAY_OF_YEAR, -1);