Übung: Primfaktorzerlegung
0
0
getPrime()
Was ist die Primfaktorzerlegung von NUMBER
?
NUMBER
Wir zeichnen die Primfaktorzerlegung als Baumdiagramm.
init({
range: [ [-1, 2], [-1, 1] ],
scale: [30, 30]
});
label( [cx, y], NUMBER );
circle( [cx, y], 0.5 );
Da NUMBER
eine Primzahl ist, ist die Primfaktorzerlegung einfach nur NUMBER
.
getComposite()
getPrimeFactorization( NUMBER )
SOLUTION.slice( 0, SOLUTION.length - 1 )
NUMBER
Was ist die Primfaktorzerlegung von NUMBER
?
SOLUTION.join("x")
Wir zeichnen die Primfaktorzerlegung als Baumdiagramm.
init({
range: [ [-1, FACTORIZATION.length + 2], [ -2 * FACTORIZATION.length - 1, 1] ],
scale: [30, 30]
});
label( [cx + 1, y], curr );
path( [ [cx + 1, y - 0.5], [cx, y - 1.5] ] );
path( [ [cx + 1, y - 0.5], [cx + 2, y - 1.5] ] );
y -= 2;
cx += 1;
curr = curr / factor;
label( [cx - 1, y], factor );
circle( [cx - 1, y], 0.5);
label( [cx + 1, y], curr );
circle( [cx + 1, y], 0.5);
Die Primfaktorzerlegung von NUMBER
ist SOLUTION.join(" × ")
.