]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/project-euler/034/034.factor
project-euler: Rewrap, update links, add copyrights, tests
[factor.git] / extra / project-euler / 034 / 034.factor
index 3d807ab941c41df6fc7fbadfaf172dfddf14a9c2..19df35f5948f515f8ca36224dab35999ca4e7c2b 100644 (file)
@@ -3,15 +3,15 @@
 USING: kernel ranges project-euler.common sequences ;
 IN: project-euler.034
 
-! https://projecteuler.net/index.php?section=problems&id=34
+! https://projecteuler.net/problem=34
 
 ! DESCRIPTION
 ! -----------
 
 ! 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
 
-! Find the sum of all numbers which are equal to the sum of the factorial of
-! their digits.
+! Find the sum of all numbers which are equal to the sum of the
+! factorial of their digits.
 
 ! Note: as 1! = 1 and 2! = 2 are not sums they are not included.
 
@@ -19,14 +19,16 @@ IN: project-euler.034
 ! SOLUTION
 ! --------
 
-! We can reduce the upper bound a little by calculating 7 * 9! = 2540160, and
-! then reducing one of the 9! to 2! (since the 7th digit cannot exceed 2), so we
-! get 2! + 6 * 9! = 2177282 as an upper bound.
+! We can reduce the upper bound a little by calculating 7 * 9! =
+! 2540160, and then reducing one of the 9! to 2! (since the 7th
+! digit cannot exceed 2), so we get 2! + 6 * 9! = 2177282 as an
+! upper bound.
 
-! We can then take that one more step, and notice that the largest factorial
-! sum a 7 digit number starting with 21 or 20 is 2! + 1! + 5 * 9! or 1814403.
-! So there can't be any 7 digit solutions starting with 21 or 20, and therefore
-! our numbers must be less that 2000000.
+! We can then take that one more step, and notice that the
+! largest factorial sum a 7 digit number starting with 21 or 20
+! is 2! + 1! + 5 * 9! or 1814403. So there can't be any 7 digit
+! solutions starting with 21 or 20, and therefore our numbers
+! must be less that 2000000.
 
 <PRIVATE