Euler problems/121 to 130
m (Corrected the links to the Euler project)
(Solution added for problem 122)
Revision as of 23:13, 1 September 2007
Investigate the game of chance involving coloured discs.
problem_121 = undefined
Finding the most efficient exponentiation method.
Solution using a depth first search, pretty fast :
import Data.List import Data.Array.Diff import Control.Monad depthAddChain 12 branch mins = mins depthAddChain d branch mins = foldl' step mins $ nub $ filter (> head branch) $ liftM2 (+) branch branch where step da e | e > 200 = da | otherwise = case compare (da ! e) d of GT -> depthAddChain (d+1) (e:branch) $ da // [(e,d)] EQ -> depthAddChain (d+1) (e:branch) da LT -> da baseBranch = [2,1] baseMins :: DiffUArray Int Int baseMins = listArray (1,200) $ 0:1: repeat maxBound problem_122 = sum . elems $ depthAddChain 2 baseBranch baseMins
Determining the remainder when (pn − 1)n + (pn + 1)n is divided by pn2.
problem_123 = undefined
Determining the kth element of the sorted radical function.
problem_124 = undefined
Finding square sums that are palindromic.
problem_125 = undefined
Exploring the number of cubes required to cover every visible face on a cuboid.
problem_126 = undefined
Investigating the number of abc-hits below a given limit.
problem_127 = undefined
Which tiles in the hexagonal arrangement have prime differences with neighbours?
problem_128 = undefined
Investigating minimal repunits that divide by n.
problem_129 = undefined
10 Problem 130
Finding composite values, n, for which n−1 is divisible by the length of the smallest repunits that divide it.
problem_130 = undefined