]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/project-euler/051/051.factor
project-euler: Rewrap, update links, add copyrights, tests
[factor.git] / extra / project-euler / 051 / 051.factor
index 8b3cb03aeca0c2f99e472a914bc93b86bba34aba..cd5bc931213c2dacf89fa90a67ed740767e5f6e0 100644 (file)
@@ -1,35 +1,35 @@
 ! Copyright (C) 2009 Jon Harper.
 ! See https://factorcode.org/license.txt for BSD license.
+USING: assocs kernel math math.combinatorics math.functions
+math.order math.parser math.primes ranges namespaces
+project-euler.common sequences sets ;
+IN: project-euler.051
 
-! https://projecteuler.net/index.php?section=problems&id=1
+! https://projecteuler.net/problem=51
 
 ! DESCRIPTION
 ! -----------
 
-
-! By replacing the first digit of *3, it turns out that
-! six of the nine possible values:
-! 13, 23, 43, 53, 73, and 83, are all prime.
-! By replacing the third and fourth digits of 56**3 with the same digit,
-! this 5-digit number is the first example having seven primes among
-! the ten generated numbers, yielding the family:
-! 56003, 56113, 56333, 56443, 56663, 56773, and 56993.
-! Consequently 56003, being the first member of this family,
-! is the smallest prime with this property.
+! By replacing the first digit of *3, it turns out that six of
+! the nine possible values: 13, 23, 43, 53, 73, and 83, are all
+! prime. By replacing the third and fourth digits of 56**3 with
+! the same digit, this 5-digit number is the first example
+! having seven primes among the ten generated numbers, yielding
+! the family: 56003, 56113, 56333, 56443, 56663, 56773, and
+! 56993. Consequently 56003, being the first member of this
+! family, is the smallest prime with this property.
 !
 ! Find the smallest prime which, by replacing part of the number
-! (not necessarily adjacent digits) with the same digit,
-! is part of an eight prime value family.
+! (not necessarily adjacent digits) with the same digit, is part
+! of an eight prime value family.
 
 ! SOLUTION
 ! --------
 
-! for each prime number, count the families it belongs to. When one reaches count of 8, stop, and get the smallest number by replacing * with ones.
+! for each prime number, count the families it belongs to. When
+! one reaches count of 8, stop, and get the smallest number by
+! replacing * with ones.
 
-USING: assocs kernel math math.combinatorics math.functions
-math.order math.parser math.primes ranges namespaces
-project-euler.common sequences sets ;
-IN: project-euler.051
 <PRIVATE
 SYMBOL: family-count
 SYMBOL: large-families