Difference between revisions of "Euler problems/171 to 180"

From HaskellWiki
Jump to navigation Jump to search
(Revert vandalism)
Line 1: Line 1:
  +
== [http://projecteuler.net/index.php?section=problems&id=171 Problem 171] ==
Do them on your own!
 
  +
Finding numbers for which the sum of the squares of the digits is a square.
  +
  +
Solution:
  +
<haskell>
  +
problem_171 = undefined
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=172 Problem 172] ==
  +
Investigating numbers with few repeated digits.
  +
  +
Solution:
  +
<haskell>
  +
problem_172 = undefined
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=173 Problem 173] ==
  +
Using up to one million tiles how many different "hollow" square laminae can be formed?
  +
Solution:
  +
<haskell>
  +
problem_173=
  +
let c=div (10^6) 4
  +
xm=floor$sqrt $fromIntegral c
  +
k=[div c x|x<-[1..xm]]
  +
in sum k-(div (xm*(xm+1)) 2)
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=174 Problem 174] ==
  +
Counting the number of "hollow" square laminae that can form one, two, three, ... distinct arrangements.
  +
  +
Solution:
  +
<haskell>
  +
problem_174 = undefined
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=175 Problem 175] ==
  +
Fractions involving the number of different ways a number can be expressed as a sum of powers of 2.
  +
Solution:
  +
<haskell>
  +
sternTree x 0=[]
  +
sternTree x y=
  +
m:sternTree y n
  +
where
  +
(m,n)=divMod x y
  +
findRat x y
  +
|odd l=take (l-1) k++[last k-1,1]
  +
|otherwise=k
  +
where
  +
k=sternTree x y
  +
l=length k
  +
p175 x y=
  +
init$foldl (++) "" [a++","|
  +
a<-map show $reverse $filter (/=0)$findRat x y]
  +
problems_175=p175 123456789 987654321
  +
test=p175 13 17
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=176 Problem 176] ==
  +
Rectangular triangles that share a cathetus.
  +
Solution:
  +
<haskell>
  +
problem_176 = undefined
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=177 Problem 177] ==
  +
Integer angled Quadrilaterals.
  +
  +
Solution:
  +
<haskell>
  +
problem_177 = undefined
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=178 Problem 178] ==
  +
Step Numbers
  +
Solution:
  +
<haskell>
  +
problem_178 = undefined
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=179 Problem 179] ==
  +
Consecutive positive divisors.
  +
Solution:
  +
<haskell>
  +
problem_179 = undefined
  +
</haskell>
  +
  +
== [http://projecteuler.net/index.php?section=problems&id=180 Problem 180] ==
  +
  +
Solution:
  +
<haskell>
  +
problem_180 = undefined
  +
</haskell>

Revision as of 06:24, 30 January 2008

Problem 171

Finding numbers for which the sum of the squares of the digits is a square.

Solution:

problem_171 = undefined

Problem 172

Investigating numbers with few repeated digits.

Solution:

problem_172 = undefined

Problem 173

Using up to one million tiles how many different "hollow" square laminae can be formed? Solution:

problem_173=
    let c=div (10^6) 4
        xm=floor$sqrt $fromIntegral c
        k=[div c x|x<-[1..xm]]
    in  sum k-(div (xm*(xm+1)) 2)

Problem 174

Counting the number of "hollow" square laminae that can form one, two, three, ... distinct arrangements.

Solution:

problem_174 = undefined

Problem 175

Fractions involving the number of different ways a number can be expressed as a sum of powers of 2. Solution:

sternTree x 0=[]
sternTree x y=
    m:sternTree y n  
    where
    (m,n)=divMod x y
findRat x y
    |odd l=take (l-1) k++[last k-1,1]
    |otherwise=k
    where
    k=sternTree x y
    l=length k
p175 x y= 
    init$foldl (++) "" [a++","|
    a<-map show $reverse $filter (/=0)$findRat x y]
problems_175=p175 123456789 987654321
test=p175 13 17

Problem 176

Rectangular triangles that share a cathetus. Solution:

problem_176 = undefined

Problem 177

Integer angled Quadrilaterals.

Solution:

problem_177 = undefined

Problem 178

Step Numbers Solution:

problem_178 = undefined

Problem 179

Consecutive positive divisors. Solution:

problem_179 = undefined

Problem 180

Solution:

problem_180 = undefined