The love for the study of magic squares and amicable numbers led Muslims to develop the theory of numbers. Al-Khujandi discovered a particular case of Fermat's theorem that "the sum of two cubes cannot be another cube", while alKaraji analyzed arithmetic and geometric progressions such as: 1^3+2^3+3^3+...+n^3=( 1+2+3+...+n)^2.
Al-Biruni also dealt with progressions while Ghiyath al-Din Jamshid al-Kashani brought the study of number theory among Muslims to its peak.
"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari