CA I - Exercise sheet 04

Exercise 1:

(a)

M=Outer[BaseForm,{1000,2^^1101101,3^^1201201,16^^ABBA77},{10,2,3,16}];
Prepend[M,{"Basis 10","Basis 2","Basis 3","Basis 16" }]//TableForm

(b)

Grid[Join[{{"Base","Representation of 1234"}},Table[{i,BaseForm[1234,i]},{i,2,16}]], Frame->All]

(c)

FromCharacterCode[{3^^2102,3^^2211,3^^2122,3^^2120,3^^2110,3^^10001,3^^2102}]

(d)

M=Table[{i,FromCharacterCode[i],BaseForm[i,16],BaseForm[i,2]},{i,48,95}];
Prepend[M,{"10er","Zeichen","16er","2er"}]//TableForm

Exercise 2

Exercise 2:

Clear[Factorize]
Factorize[n_]:=Module[
{m,p,factors},
m = n; p = 2; factors = {};
While[m≠ 1,
If[Mod[m,p]==0,
m /=p;
AppendTo[factors,p],
p = NextPrime[p]
];
];
factors
]

Factorize[12345]

FactorInteger[12345]