Prime factors of a number

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{--

From the P-99 Prolog problem set, exercises 35, 36: prime factors.

P35: Find the prime factors of a given positive integer greater than 1:

 --}

primeFactors :: Integer -> [Integer]
primeFactors n = undefined

{--

Apply primeFactors to all the numbers given below (thank you, random.org).

554621
229558
280884
513462 -- this one is tricky with a prime factor of 85577 -- 7'30"
551418
96467  -- this one has a prime factor of 13781 ... garbage collection?
319263
480355
882602
278410
964438
460282
469102
806036
416922
630363 -- blech!
788380 -- this is where I said, okay, enough is enough!
461331
419818
997638 -- the ones up to here were very fast, but now: (True,166273)
-- spent 3 hours with no termination on that one. :(
588634
51549
848759
686765
739023
582112
645056
861956
692063
751578
831612
648665
760310
564409
377543
576664
208616
785950
813692
988871
445098
298833
811843
363767
365218
914264
798554
976592
55115
240255

P36: Now, group these prime factors. One way do to this is as was demonstrated
in the P-99 problem set: --}

groupedPrimeFactors :: Integer -> [(Integer, Int)]
groupedPrimeFactors n = undefined

{--

So, for example:

*Main> groupedPrimeFactors 315 ~> [(3, 2), (5, 1), (7, 1)]

A solution-set is available at http://lpaste.net/107939

 --}