In mathematics, a Kaprekar number for a given base is a non_negative_integer, the representation of whose square in that base can be split into two parts that add up to the original number again. For instance, 297 is a Kaprekar number, because 97² = 88209 and 88+209 = 297. The Kaprekar numbers are named after D. R. Kaprekar. How […]
Tag Archives: IRB
Ruby Inject
As part of my code every day challenge, today I am taking a look at the Ruby Inject method. I never really understood how the Ruby inject method worked and why one might use it. The Ruby inject method is useful for aggregating data. For example a summation could be done with inject (by aggregating […]