Teilaufgabe a


In [1]:
function factorize_me(M, output=true)
    f1 = Int(round(sqrt(M), RoundDown))
    f2 = f1+1
    while f1 > 0
        if output
            println(@sprintf("%i\t%i", f1, f2))
        end
        if f1*f2 == M
            break
        elseif f1*f2 > M
            f1 -= 1
        else
            f2 +=1
        end
    end
    return (f1, f2)
end
factorize_me(731)


27	28
26	28
26	29
25	29
25	30
24	30
24	31
23	31
23	32
22	32
22	33
22	34
21	34
21	35
20	35
20	36
20	37
19	37
19	38
19	39
18	39
18	40
18	41
17	41
17	42
17	43
Out[1]:
(17,43)

Teilaufgabe b


In [2]:
z = [5047632089, 29597574011, 67873310559651, 1556617449037459651]
for i in 1:4
    (f1, f2) = factorize_me(z[i], false)
    println(@sprintf("z%i is the product of %i and %i", i, f1, f2))
end


z1 is the product of 56453 and 89413
z2 is the product of 56453 and 524287
z3 is the product of 8238221 and 8238831
z4 is the product of 1237238221 and 1258138831