$\textsf{Your solution}$

list of values entered by the user

from this list comes the number ini, which indicates from which point of the list 2 we start picking random factors

list of prime factors to build the number to factor

factors of the random number to factor

list including the number to factor and the values entered by the user

these booleans control the visibiliy of the nodes

list of circles currently shown

Determines the circles that are ends of branches. It's used for grading (list students factor) and for determining if + or - buttons are shown

Branches shown in screen: 1st element, parent node. 2nd and 3rd, children. 4th, index of 1st node. Use for grading list(each branch OK)

checks if each branch is correct

Used to determine the horizontal displacements between the circles

indicates the horizontal displacement of circles from one level to the next one

Picks the first incorrect branch to highlight if showtypicalhint is shown

#4D4D4D

$\text{Check}$

$\text{NUEVO}$

No selection allowed for all input boxes

Fix position and allow selection for all text objects

Empty all input boxes

\text{This is the answer.}

\text{\text{\bold{Posible solución}\\Compara tu solución con\la solución dada.}

$a=\vphantom{b}$

Reset app

#006758

#B00020

#252525

#757575

#949494

#E44461

#008475

#5145A8

#6557D2

#8575FF

#C75000

#E07415

\textsf{Debes encontrar todos los\
números primos que, al\
multiplicarlos, dan el\
número 
dado.}

#eeeeee

#2E006758

#2EB00020

\text{Completa el árbol para crear una factorización prima del número. } 

background added to unselect all circles

shows/hides + - buttons and inputbox

Add nodes

Remove nodes

List of all the centers of the circles. They come from the spreadsheet

List of centers currently visible on screen.

script circle

list with the values visible on screen

list of centers of the circles in the solution

circles shown in the solution

Elements in the spreadsheet: A: Circles' centers, B: Level at which the circle belong; C: Circles; D: child 1, F: chlid 2; E/G: segments joining parent circle and its children. H: number: levels below; J: offSpring. Elements below the circle that are visible.

when you click on a circle, the number of the circle is recorded into the variable selectedCircleNumber, and the script of scriptCircle is executed, making visible the inputbox and the button to 
add or remove branches from the tree.

When you enter a number into the input box, the element selectedCircleNumber from the list “values” is replaced by the entered number.

If you press +, the children of the circle become visible. If you press -, all the visible offsprings of the circle become hidden (column J).

The list branches shows all the visible branches: {parent,child1,child2,parent ID}
The list each branch ok indicates if child1*child2=parent for each visible branch. If there's an incorrect branch, correct=false

All the branches can be correct, but the tree can be incomplete, so the variable correct also checks that the numbers in the circles that are ends of branches
coincide with the list of factors of the number on the top of the tree.

\textsf{Continúa hasta que solamente\
haya números primos\
en la base del árbol.}

1 = arrow left, 2 = arrow right, 3 = arrow uo, 4 = arrow down

list of texts showing the numbers entered by the user

numbers shown in the solution

showsolution = false
yoursolution = false
validate = false
countCorrect = 0
values: {NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN}
countQuestion = 0
PosFactorsLevel2 = Shuffle(Flatten[{Sequence[{2, 3, 5}, ii, 1, 5], {If[Mod[countQuestion, 2] ≟ 0, 7, 11]}}])
PosFactorsLevel1 = Shuffle(Flatten[Sequence[{2, 3, 5}, ii, 1, 5]])
PosFactorsLevel3 = Shuffle(Flatten[{Sequence[{2, 3, 5}, ii, 1, 5], Sequence[{7, 11}, ii, 1, 2]}])
randomList3 = Shuffle(Sequence[1, 10])
ini = Element(randomList3, Mod[countQuestion, Length[randomList3]] + 1)
randomList1 = Shuffle(Flatten[{Sequence[3, ii, 1, 8], Sequence[4, ii, 1, 7], Sequence[5, ii, 1, 3]}])
randomNum1 = Element(randomList1, Mod[countQuestion, 20] + 1)
numberOfFactors: randomNum1
randomList2 = If(countCorrect ≤ 5, PosFactorsLevel1, If[countCorrect ≤ 10, PosFactorsLevel2, PosFactorsLevel3])
factors = Sequence(Element[randomList2, kk], kk, ini, ini + numberOfFactors - 1)
numberToFactor = Product(factors)
valueswithIni = Append(numberToFactor, values)
visibles: {true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}
circlesVisibles = Append(1, RemoveUndefined[Flatten[Sequence[If[visibles(kk), {(2 * kk), (2 * kk) + 1}], kk, 1, Length[visibles]]]])
EndsOfBranches = RemoveUndefined(Sequence[If[Defined[IndexOf[kk, circlesVisibles]] ∧ (¬Element[visibles, kk]), kk], kk, 1, Length[visibles]])
studentFactors = Zip(valueswithIni(kk), kk, EndsOfBranches)
correct3: Product[studentFactors] ≟ numberToFactor
branches = RemoveUndefined(Sequence[If[visibles(kk), {valueswithIni(kk), valueswithIni((2 * kk)), valueswithIni((2 * kk) + 1), kk}], kk, 1, Length[visibles]])
branchesFlat = Flatten(branches)
eachBranchOk = Zip(Element[AA, 1] ≟ (Element[AA, 2] * Element[AA, 3]), AA, branches)
correct2: ¬Defined[IndexOf[false, eachBranchOk]]
correct1: Sort[factors] ≟ Sort[studentFactors]
correct: correct1 ∧ correct2
isTypicalError1 = Defined(IndexOf[false, eachBranchOk])
isTypicalError2: correct2 ∧ (¬correct1)
View = 0 (slider from (-maxSlider) to maxSlider)
visiblesPerLevel = Sequence(Sequence[Element[visibles, ii], ii, 2^(kk), 2^(kk + 1) - 1], kk, 0, 5)
visiblesPerLevelNumber = Zip(CountIf[x ≟ true, AA], AA, visiblesPerLevel)
maxVisibleLevel: IndexOf[0, visiblesPerLevelNumber] - 1
B1: 1
despPerLevelNoWide: {1, 1, 1, 1, 1, 1}
wideTree: Max[visiblesPerLevelNumber] ≥ 2
despPerLevelWide: {{1, 1, 1, 1, 1, 1}, {1.5, 0.8, 1, 1, 1, 1}, If[visiblesPerLevelNumber(3) ≟ 1, {1.5, 0.8, 0.8, 1, 1, 1}, {2.5, 1.2, 0.6, 1, 1, 1}], If[visiblesPerLevelNumber(4) ≟ 1, {2.5, 1.2, 0.6, 0.6, 1, 1}, {4.8, 2.4, 1.2, 0.6, 1, 1}], If[visiblesPerLevelNumber(5) ≟ 1, {4.8, 2.4, 1.2, 0.6, 0.6, 1}, {9.6, 4.8, 2.4, 1.2, 0.6, 1}]}
despPerLevel = If(wideTree, Element[despPerLevelWide, maxVisibleLevel], despPerLevelNoWide)
incorrectBranch = Element(branches, IndexOf[false, eachBranchOk])
randomNum2 = Element(randomList2, Mod[countQuestion, 15] + 1)
input2: NaN
input1: 60
showanswer = false
tries = 0
showhint = false
InputBox1 = Textfield(input1)
showbuttons = true
typicalError1: 0
typicalError2: 0
helpTextHintTypicalError: "\textsf{Revisa la rama resaltada.\\
¿Es cierto que " + (LaTeX[Element[incorrectBranch, 1]]) + " = " + (LaTeX[Element[incorrectBranch, 2]]) + " \times " + (LaTeX[Element[incorrectBranch, 3]]) + "\textsf{?}"
showhinttypicalerror = false
radCircle: 0.5
A1: (0, 6)
C1 = Circle(A1, radCircle)
despVer = If(maxVisibleLevel ≤ 3, 1, maxVisibleLevel ≟ 4, 0.9, 0.85)
D1: A1 - (Element[despPerLevel, B1], despVer)
E1 = Segment(A1, D1)
F1: A1 + (Element[despPerLevel, B1], (-despVer))
G1 = Segment(A1, F1)
A2: D1
A3: F1
B2: 2
B3: 2
C2 = Circle(A2, radCircle)
C3 = Circle(A3, radCircle)
D2: A2 - (Element[despPerLevel, B2], despVer)
D3: A3 - (Element[despPerLevel, B3], despVer)
E2 = Segment(A2, D2)
E3 = Segment(A3, D3)
F2: A2 + (Element[despPerLevel, B2], (-despVer))
F3: A3 + (Element[despPerLevel, B3], (-despVer))
G2 = Segment(A2, F2)
G3 = Segment(A3, F3)
A4: D2
A5: F2
A6: D3
A7: F3
B4: 3
B5: 3
B6: 3
B7: 3
C4 = Circle(A4, radCircle)
C5 = Circle(A5, radCircle)
C6 = Circle(A6, radCircle)
C7 = Circle(A7, radCircle)
D4: A4 - (Element[despPerLevel, B4], despVer)
D5: A5 - (Element[despPerLevel, B5], despVer)
D6: A6 - (Element[despPerLevel, B6], despVer)
D7: A7 - (Element[despPerLevel, B7], despVer)
E4 = Segment(A4, D4)
E5 = Segment(A5, D5)
E6 = Segment(A6, D6)
E7 = Segment(A7, D7)
F4: A4 + (Element[despPerLevel, B4], (-despVer))
F5: A5 + (Element[despPerLevel, B5], (-despVer))
F6: A6 + (Element[despPerLevel, B6], (-despVer))
F7: A7 + (Element[despPerLevel, B7], (-despVer))
G4 = Segment(A4, F4)
G5 = Segment(A5, F5)
G6 = Segment(A6, F6)
G7 = Segment(A7, F7)
A8: D4
A9: F4
A10: D5
A11: F5
A12: D6
A13: F6
A14: D7
A15: F7
B8: 4
B9: 4
B10: 4
B11: 4
B12: 4
B13: 4
B14: 4
B15: 4
C8 = Circle(A8, radCircle)
C9 = Circle(A9, radCircle)
C10 = Circle(A10, radCircle)
C11 = Circle(A11, radCircle)
C12 = Circle(A12, radCircle)
C13 = Circle(A13, radCircle)
C14 = Circle(A14, radCircle)
C15 = Circle(A15, radCircle)
D8: A8 - (Element[despPerLevel, B8], despVer)
D9: A9 - (Element[despPerLevel, B9], despVer)
D10: A10 - (Element[despPerLevel, B10], despVer)
D11: A11 - (Element[despPerLevel, B11], despVer)
D12: A12 - (Element[despPerLevel, B12], despVer)
D13: A13 - (Element[despPerLevel, B13], despVer)
D14: A14 - (Element[despPerLevel, B14], despVer)
D15: A15 - (Element[despPerLevel, B15], despVer)
E8 = Segment(A8, D8)
E9 = Segment(A9, D9)
E10 = Segment(A10, D10)
E11 = Segment(A11, D11)
E12 = Segment(A12, D12)
E13 = Segment(A13, D13)
E14 = Segment(A14, D14)
E15 = Segment(A15, D15)
F8: A8 + (Element[despPerLevel, B8], (-despVer))
F9: A9 + (Element[despPerLevel, B9], (-despVer))
F10: A10 + (Element[despPerLevel, B10], (-despVer))
F11: A11 + (Element[despPerLevel, B11], (-despVer))
F12: A12 + (Element[despPerLevel, B12], (-despVer))
F13: A13 + (Element[despPerLevel, B13], (-despVer))
F14: A14 + (Element[despPerLevel, B14], (-despVer))
F15: A15 + (Element[despPerLevel, B15], (-despVer))
G8 = Segment(A8, F8)
G9 = Segment(A9, F9)
G10 = Segment(A10, F10)
G11 = Segment(A11, F11)
G12 = Segment(A12, F12)
G13 = Segment(A13, F13)
G14 = Segment(A14, F14)
G15 = Segment(A15, F15)
A16: D8
A17: F8
A18: D9
A19: F9
A20: D10
A21: F10
A22: D11
A23: F11
A24: D12
A25: F12
A26: D13
A27: F13
A28: D14
A29: F14
A30: D15
A31: F15
B16: 5
B17: 5
B18: 5
B19: 5
B20: 5
B21: 5
B22: 5
B23: 5
B24: 5
B25: 5
B26: 5
B27: 5
B28: 5
B29: 5
B30: 5
B31: 5
C16 = Circle(A16, radCircle)
C17 = Circle(A17, radCircle)
C18 = Circle(A18, radCircle)
C19 = Circle(A19, radCircle)
C20 = Circle(A20, radCircle)
C21 = Circle(A21, radCircle)
C22 = Circle(A22, radCircle)
C23 = Circle(A23, radCircle)
C24 = Circle(A24, radCircle)
C25 = Circle(A25, radCircle)
C26 = Circle(A26, radCircle)
C27 = Circle(A27, radCircle)
C28 = Circle(A28, radCircle)
C29 = Circle(A29, radCircle)
C30 = Circle(A30, radCircle)
C31 = Circle(A31, radCircle)
D16: A16 - (Element[despPerLevel, B16], despVer)
D17: A17 - (Element[despPerLevel, B17], despVer)
D18: A18 - (Element[despPerLevel, B18], despVer)
D19: A19 - (Element[despPerLevel, B19], despVer)
D20: A20 - (Element[despPerLevel, B20], despVer)
D21: A21 - (Element[despPerLevel, B21], despVer)
D22: A22 - (Element[despPerLevel, B22], despVer)
D23: A23 - (Element[despPerLevel, B23], despVer)
D24: A24 - (Element[despPerLevel, B24], despVer)
D25: A25 - (Element[despPerLevel, B25], despVer)
D26: A26 - (Element[despPerLevel, B26], despVer)
D27: A27 - (Element[despPerLevel, B27], despVer)
D28: A28 - (Element[despPerLevel, B28], despVer)
D29: A29 - (Element[despPerLevel, B29], despVer)
D30: A30 - (Element[despPerLevel, B30], despVer)
D31: A31 - (Element[despPerLevel, B31], despVer)
E16 = Segment(A16, D16)
E17 = Segment(A17, D17)
E18 = Segment(A18, D18)
E19 = Segment(A19, D19)
E20 = Segment(A20, D20)
E21 = Segment(A21, D21)
E22 = Segment(A22, D22)
E23 = Segment(A23, D23)
E24 = Segment(A24, D24)
E25 = Segment(A25, D25)
E26 = Segment(A26, D26)
E27 = Segment(A27, D27)
E28 = Segment(A28, D28)
E29 = Segment(A29, D29)
E30 = Segment(A30, D30)
E31 = Segment(A31, D31)
F16: A16 + (Element[despPerLevel, B16], (-despVer))
F17: A17 + (Element[despPerLevel, B17], (-despVer))
F18: A18 + (Element[despPerLevel, B18], (-despVer))
F19: A19 + (Element[despPerLevel, B19], (-despVer))
F20: A20 + (Element[despPerLevel, B20], (-despVer))
F21: A21 + (Element[despPerLevel, B21], (-despVer))
F22: A22 + (Element[despPerLevel, B22], (-despVer))
F23: A23 + (Element[despPerLevel, B23], (-despVer))
F24: A24 + (Element[despPerLevel, B24], (-despVer))
F25: A25 + (Element[despPerLevel, B25], (-despVer))
F26: A26 + (Element[despPerLevel, B26], (-despVer))
F27: A27 + (Element[despPerLevel, B27], (-despVer))
F28: A28 + (Element[despPerLevel, B28], (-despVer))
F29: A29 + (Element[despPerLevel, B29], (-despVer))
F30: A30 + (Element[despPerLevel, B30], (-despVer))
F31: A31 + (Element[despPerLevel, B31], (-despVer))
G16 = Segment(A16, F16)
G17 = Segment(A17, F17)
G18 = Segment(A18, F18)
G19 = Segment(A19, F19)
G20 = Segment(A20, F20)
G21 = Segment(A21, F21)
G22 = Segment(A22, F22)
G23 = Segment(A23, F23)
G24 = Segment(A24, F24)
G25 = Segment(A25, F25)
G26 = Segment(A26, F26)
G27 = Segment(A27, F27)
G28 = Segment(A28, F28)
G29 = Segment(A29, F29)
G30 = Segment(A30, F30)
G31 = Segment(A31, F31)
A32: D16
A33: F16
A34: D17
A35: F17
A36: D18
A37: F18
A38: D19
A39: F19
A40: D20
A42: D21
A43: F21
A44: D22
A45: F22
A46: D23
A47: F23
A41: F20
A48: D24
A49: F24
A50: D25
A51: F25
A52: D26
A53: F26
A54: D27
A55: F27
A56: D28
A57: F28
A58: D29
A59: F29
A60: D30
A61: F30
A62: D31
A63: F31
B32: 6
B33: 6
B34: 6
B35: 6
B36: 6
B37: 6
B38: 6
B39: 6
B40: 6
B41: 6
B42: 6
B43: 6
B44: 6
B45: 6
B46: 6
B47: 6
B48: 6
B49: 6
B50: 6
B51: 6
B52: 6
B53: 6
B54: 6
B55: 6
B56: 6
B57: 6
B58: 6
B59: 6
B60: 6
B61: 6
B62: 6
B63: 6
C32 = Circle(A32, radCircle)
C33 = Circle(A33, radCircle)
C34 = Circle(A34, radCircle)
C35 = Circle(A35, radCircle)
C36 = Circle(A36, radCircle)
C37 = Circle(A37, radCircle)
C38 = Circle(A38, radCircle)
C39 = Circle(A39, radCircle)
C40 = Circle(A40, radCircle)
C41 = Circle(A41, radCircle)
C42 = Circle(A42, radCircle)
C43 = Circle(A43, radCircle)
C44 = Circle(A44, radCircle)
C45 = Circle(A45, radCircle)
C46 = Circle(A46, radCircle)
C47 = Circle(A47, radCircle)
C48 = Circle(A48, radCircle)
C49 = Circle(A49, radCircle)
C50 = Circle(A50, radCircle)
C51 = Circle(A51, radCircle)
C52 = Circle(A52, radCircle)
C53 = Circle(A53, radCircle)
C54 = Circle(A54, radCircle)
C55 = Circle(A55, radCircle)
C56 = Circle(A56, radCircle)
C57 = Circle(A57, radCircle)
C58 = Circle(A58, radCircle)
C59 = Circle(A59, radCircle)
C60 = Circle(A60, radCircle)
C61 = Circle(A61, radCircle)
C62 = Circle(A62, radCircle)
C63 = Circle(A63, radCircle)
q1 = Polygon({(-10, -10), (10, -10), (10, 10), (-10, 10)})
selectedCircle = false
selectedCircleNumber = 3
selectedCenter = Cell(1, selectedCircleNumber)
BtnAddPos: selectedCenter - ((12.31 / 800 * 12), 0.6)
IBPosition: selectedCenter + (-0.35, 0.25)
H1: 1
H2: H1 + 1
H3: H2 + 1
H4: H3 + 1
H5: H4 + 1
H6: H5 + 1
H7: H6 + 1
H8: H7 + 1
H9: H8 + 1
H10: H9 + 1
H11: H10 + 1
H12: H11 + 1
H13: H12 + 1
H14: H13 + 1
H15: H14 + 1
H16: H15 + 1
H17: H16 + 1
H18: H17 + 1
H19: H18 + 1
H20: H19 + 1
H21: H20 + 1
H22: H21 + 1
H23: H22 + 1
H24: H23 + 1
H25: H24 + 1
H26: H25 + 1
H27: H26 + 1
H28: H27 + 1
H29: H28 + 1
H30: H29 + 1
H31: H30 + 1
H32: H31 + 1
H33: H32 + 1
H34: H33 + 1
H35: H34 + 1
H36: H35 + 1
H37: H36 + 1
H38: H37 + 1
H39: H38 + 1
H40: H39 + 1
H41: H40 + 1
H42: H41 + 1
H43: H42 + 1
H44: H43 + 1
H45: H44 + 1
H46: H45 + 1
H47: H46 + 1
H48: H47 + 1
H49: H48 + 1
H50: H49 + 1
H51: H50 + 1
H52: H51 + 1
H53: H52 + 1
H54: H53 + 1
H55: H54 + 1
H56: H55 + 1
H57: H56 + 1
H58: H57 + 1
H59: H58 + 1
H60: H59 + 1
H61: H60 + 1
H62: H61 + 1
H63: H62 + 1
I1: 6 - B1
I2: 6 - B2
I3: 6 - B3
I4: 6 - B4
I5: 6 - B5
I6: 6 - B6
I7: 6 - B7
I8: 6 - B8
I9: 6 - B9
I10: 6 - B10
I11: 6 - B11
I12: 6 - B12
I13: 6 - B13
I14: 6 - B14
I15: 6 - B15
I16: 6 - B16
I17: 6 - B17
I18: 6 - B18
I19: 6 - B19
I20: 6 - B20
I21: 6 - B21
I22: 6 - B22
I23: 6 - B23
I24: 6 - B24
I25: 6 - B25
I26: 6 - B26
I27: 6 - B27
I28: 6 - B28
I29: 6 - B29
I30: 6 - B30
I31: 6 - B31
I32: 6 - B32
I33: 6 - B33
I34: 6 - B34
I35: 6 - B35
I36: 6 - B36
I37: 6 - B37
I38: 6 - B38
I39: 6 - B39
I40: 6 - B40
I41: 6 - B41
I42: 6 - B42
I43: 6 - B43
I44: 6 - B44
I45: 6 - B45
I46: 6 - B46
I47: 6 - B47
I48: 6 - B48
I49: 6 - B49
I50: 6 - B50
I51: 6 - B51
I52: 6 - B52
I53: 6 - B53
I54: 6 - B54
I55: 6 - B55
I56: 6 - B56
I57: 6 - B57
I58: 6 - B58
I59: 6 - B59
I60: 6 - B60
I61: 6 - B61
I62: 6 - B62
I63: 6 - B63
J2 = Flatten(Sequence[Sequence[(2^(ii) * H2) + jj, jj, 0, 2^(ii) - 1], ii, 1, I2])
J3 = Flatten(Sequence[Sequence[(2^(ii) * H3) + jj, jj, 0, 2^(ii) - 1], ii, 1, I3])
J4 = Flatten(Sequence[Sequence[(2^(ii) * H4) + jj, jj, 0, 2^(ii) - 1], ii, 1, I4])
J5 = Flatten(Sequence[Sequence[(2^(ii) * H5) + jj, jj, 0, 2^(ii) - 1], ii, 1, I5])
J6 = Flatten(Sequence[Sequence[(2^(ii) * H6) + jj, jj, 0, 2^(ii) - 1], ii, 1, I6])
J7 = Flatten(Sequence[Sequence[(2^(ii) * H7) + jj, jj, 0, 2^(ii) - 1], ii, 1, I7])
J8 = Flatten(Sequence[Sequence[(2^(ii) * H8) + jj, jj, 0, 2^(ii) - 1], ii, 1, I8])
J9 = Flatten(Sequence[Sequence[(2^(ii) * H9) + jj, jj, 0, 2^(ii) - 1], ii, 1, I9])
J10 = Flatten(Sequence[Sequence[(2^(ii) * H10) + jj, jj, 0, 2^(ii) - 1], ii, 1, I10])
J11 = Flatten(Sequence[Sequence[(2^(ii) * H11) + jj, jj, 0, 2^(ii) - 1], ii, 1, I11])
J12 = Flatten(Sequence[Sequence[(2^(ii) * H12) + jj, jj, 0, 2^(ii) - 1], ii, 1, I12])
J13 = Flatten(Sequence[Sequence[(2^(ii) * H13) + jj, jj, 0, 2^(ii) - 1], ii, 1, I13])
J14 = Flatten(Sequence[Sequence[(2^(ii) * H14) + jj, jj, 0, 2^(ii) - 1], ii, 1, I14])
J15 = Flatten(Sequence[Sequence[(2^(ii) * H15) + jj, jj, 0, 2^(ii) - 1], ii, 1, I15])
J16 = Flatten(Sequence[Sequence[(2^(ii) * H16) + jj, jj, 0, 2^(ii) - 1], ii, 1, I16])
J17 = Flatten(Sequence[Sequence[(2^(ii) * H17) + jj, jj, 0, 2^(ii) - 1], ii, 1, I17])
J18 = Flatten(Sequence[Sequence[(2^(ii) * H18) + jj, jj, 0, 2^(ii) - 1], ii, 1, I18])
J19 = Flatten(Sequence[Sequence[(2^(ii) * H19) + jj, jj, 0, 2^(ii) - 1], ii, 1, I19])
J20 = Flatten(Sequence[Sequence[(2^(ii) * H20) + jj, jj, 0, 2^(ii) - 1], ii, 1, I20])
J21 = Flatten(Sequence[Sequence[(2^(ii) * H21) + jj, jj, 0, 2^(ii) - 1], ii, 1, I21])
J22 = Flatten(Sequence[Sequence[(2^(ii) * H22) + jj, jj, 0, 2^(ii) - 1], ii, 1, I22])
J23 = Flatten(Sequence[Sequence[(2^(ii) * H23) + jj, jj, 0, 2^(ii) - 1], ii, 1, I23])
J24 = Flatten(Sequence[Sequence[(2^(ii) * H24) + jj, jj, 0, 2^(ii) - 1], ii, 1, I24])
J25 = Flatten(Sequence[Sequence[(2^(ii) * H25) + jj, jj, 0, 2^(ii) - 1], ii, 1, I25])
J26 = Flatten(Sequence[Sequence[(2^(ii) * H26) + jj, jj, 0, 2^(ii) - 1], ii, 1, I26])
J27 = Flatten(Sequence[Sequence[(2^(ii) * H27) + jj, jj, 0, 2^(ii) - 1], ii, 1, I27])
J28 = Flatten(Sequence[Sequence[(2^(ii) * H28) + jj, jj, 0, 2^(ii) - 1], ii, 1, I28])
J29 = Flatten(Sequence[Sequence[(2^(ii) * H29) + jj, jj, 0, 2^(ii) - 1], ii, 1, I29])
J30 = Flatten(Sequence[Sequence[(2^(ii) * H30) + jj, jj, 0, 2^(ii) - 1], ii, 1, I30])
J31 = Flatten(Sequence[Sequence[(2^(ii) * H31) + jj, jj, 0, 2^(ii) - 1], ii, 1, I31])
K2 = Unique(Zip[floor(kk / 2), kk, J2])
K3 = Unique(Zip[floor(kk / 2), kk, J3])
K4 = Unique(Zip[floor(kk / 2), kk, J4])
K5 = Unique(Zip[floor(kk / 2), kk, J5])
K6 = Unique(Zip[floor(kk / 2), kk, J6])
K7 = Unique(Zip[floor(kk / 2), kk, J7])
K8 = Unique(Zip[floor(kk / 2), kk, J8])
K9 = Unique(Zip[floor(kk / 2), kk, J9])
K10 = Unique(Zip[floor(kk / 2), kk, J10])
K11 = Unique(Zip[floor(kk / 2), kk, J11])
K12 = Unique(Zip[floor(kk / 2), kk, J12])
K13 = Unique(Zip[floor(kk / 2), kk, J13])
K14 = Unique(Zip[floor(kk / 2), kk, J14])
K15 = Unique(Zip[floor(kk / 2), kk, J15])
K16 = Unique(Zip[floor(kk / 2), kk, J16])
K17 = Unique(Zip[floor(kk / 2), kk, J17])
K18 = Unique(Zip[floor(kk / 2), kk, J18])
K19 = Unique(Zip[floor(kk / 2), kk, J19])
K20 = Unique(Zip[floor(kk / 2), kk, J20])
K21 = Unique(Zip[floor(kk / 2), kk, J21])
K22 = Unique(Zip[floor(kk / 2), kk, J22])
K23 = Unique(Zip[floor(kk / 2), kk, J23])
K24 = Unique(Zip[floor(kk / 2), kk, J24])
K25 = Unique(Zip[floor(kk / 2), kk, J25])
K26 = Unique(Zip[floor(kk / 2), kk, J26])
K27 = Unique(Zip[floor(kk / 2), kk, J27])
K28 = Unique(Zip[floor(kk / 2), kk, J28])
K29 = Unique(Zip[floor(kk / 2), kk, J29])
K30 = Unique(Zip[floor(kk / 2), kk, J30])
K31 = Unique(Zip[floor(kk / 2), kk, J31])
Centers: {A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29, A30, A31, A32, A33, A34, A35, A36, A37, A38, A39, A40, A41, A42, A43, A44, A45, A46, A47, A48, A49, A50, A51, A52, A53, A54, A55, A56, A57, A58, A59, A60, A61, A62, A63}
VisibleCenters = Zip(Centers(kk), kk, circlesVisibles)
numbersVisibles = RemoveUndefined(Zip[valueswithIni(kk), kk, circlesVisibles])
numberOfCirclesVisibles = Length(circlesVisibles)
numberOfNumbersVisibles = Length(numbersVisibles)
highlight1 = Element(Element[branches, IndexOf[false, eachBranchOk]], 4)
highlight2: (2 * highlight1)
highlight3: (2 * highlight1) + 1
isTypicalError: isTypicalError1 ∨ isTypicalError2
sortedFactors = Sort(factors)
solutionCenters = Take(Append[(0, 6), Sequence[{(-2 + kk, 6 - kk), (kk, 6 - kk)}, kk, 1, 5]], 1, Length[sortedFactors])
sortedQuotients = Sequence(numberToFactor / Product[Take[sortedFactors, 1, ii]], ii, 1, Length[sortedFactors])
solutionSegments = Append(Sequence[Segment[solutionCenters(1), Element[solutionCenters(2), kk]], kk, 1, 2], Zip[Sequence[Segment[Element[AA, 2], Element[BB, kk]], kk, 1, 2], AA, Take[solutionCenters, 2], BB, Take[solutionCenters, 3]])
solutionCircles = Zip(Circle[AA, 0.5], AA, Flatten[solutionCenters])
L2 = KeepIf(Element[visibles, kk], kk, K2)
L3 = KeepIf(Element[visibles, kk], kk, K3)
L4 = KeepIf(Element[visibles, kk], kk, K4)
L5 = KeepIf(Element[visibles, kk], kk, K5)
L6 = KeepIf(Element[visibles, kk], kk, K6)
L7 = KeepIf(Element[visibles, kk], kk, K7)
L8 = KeepIf(Element[visibles, kk], kk, K8)
L9 = KeepIf(Element[visibles, kk], kk, K9)
L10 = KeepIf(Element[visibles, kk], kk, K10)
L11 = KeepIf(Element[visibles, kk], kk, K11)
L12 = KeepIf(Element[visibles, kk], kk, K12)
L13 = KeepIf(Element[visibles, kk], kk, K13)
L14 = KeepIf(Element[visibles, kk], kk, K14)
L15 = KeepIf(Element[visibles, kk], kk, K15)
L16 = KeepIf(Element[visibles, kk], kk, K16)
L17 = KeepIf(Element[visibles, kk], kk, K17)
L18 = KeepIf(Element[visibles, kk], kk, K18)
L19 = KeepIf(Element[visibles, kk], kk, K19)
L20 = KeepIf(Element[visibles, kk], kk, K20)
L21 = KeepIf(Element[visibles, kk], kk, K21)
L22 = KeepIf(Element[visibles, kk], kk, K22)
L23 = KeepIf(Element[visibles, kk], kk, K23)
L24 = KeepIf(Element[visibles, kk], kk, K24)
L25 = KeepIf(Element[visibles, kk], kk, K25)
L26 = KeepIf(Element[visibles, kk], kk, K26)
L27 = KeepIf(Element[visibles, kk], kk, K27)
L28 = KeepIf(Element[visibles, kk], kk, K28)
L29 = KeepIf(Element[visibles, kk], kk, K29)
L30 = KeepIf(Element[visibles, kk], kk, K30)
L31 = KeepIf(Element[visibles, kk], kk, K31)
delete: {3}
highL1Yes: Mod[valueswithIni(highlight1), valueswithIni(highlight2)] ≠ 0 ∨ valueswithIni(highlight1) ≟ valueswithIni(highlight2)
highL2Yes: Mod[valueswithIni(highlight1), valueswithIni(highlight3)] ≠ 0 ∨ (¬highL1Yes) ∨ valueswithIni(highlight1) ≟ valueswithIni(highlight3)
A_{1} = (1, 1)
onboardingPoint_{1} = (2, 5)
AstartPos_{1}: (1, 1)
xCentersVisib = Zip(x(A), A, VisibleCenters)
minX = Min(xCentersVisib)
maxX = Max(xCentersVisib)
showVisibSlider: maxX ≥ 5.5 ∨ minX ≤ -5.5
maxSlider = If(showVisibSlider, 0.7 + Max[maxX - 5.5, abs(minX + 5.5)], 1)
xCor2 = If(¬showVisibSlider, 6.15402, 6.15402 + View)
xCor1 = If(¬showVisibSlider, -6.15402, -6.15402 + View)
m1 = Flatten(Append[{Text[numberToFactor], If[¬validate, "≟", If[correct3 ∨ showsolution ∧ (¬yoursolution), "=", "≠"]]}, Take[Flatten[Zip[{If[Defined[kk], Text[kk], "\tiny{\colorbox{#949494}{\vspace{20}\hspace{15}}}"], "\times"}, kk, studentFactors]], 1, (2 * Length[studentFactors]) - 1]])
m2 = Flatten(Append[{Text[numberToFactor], If[showsolution ∧ yoursolution ∧ (¬correct), "≠", "="]}, Take[Flatten[Zip[{If[Defined[kk], Text[kk], "\tiny{\colorbox{#949494}{\vspace{20}\hspace{15}}}"], "\times"}, kk, sortedFactors]], 1, (2 * Length[sortedFactors]) - 1]])
layoutX: 194
layoutY: 448
studentFactorsNonPrime = KeepIf(¬IsPrime[kk], kk, studentFactors)
orangeCircles = If(Length[studentFactorsNonPrime] ≥ 1, Zip[Element[EndsOfBranches, IndexOf[kk, studentFactors]], kk, studentFactorsNonPrime], {})
inputCurrent: branchesFlat
inputSaved: {NaN, NaN}
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
onboarding_{1} = true
onboardingX_{1}: 510
onboardingY_{1}: 170
onboardingText_{1}: "\text{" + (LaTeX[If[¬selectedCircle, "Clic para editar", "Escribe un número / \\Presiona + para\\agregar ramas"]]) + "}"
onboardingCase_{1} = 1
OnboardingTextOffset_{1} = onboardingTextOffset(Corner[onboardingText_{1}, 1], Corner[onboardingText_{1}, 3], onboardingCase_{1}, Corner[1], Corner[3], Corner[5])
onboardingDisplayText_{1}: "\text{\vphantom{Og}" + (LaTeX[onboardingText_{1}]) + "}"
pulsingSpeed: 8
pulsing = 0.62 (slider from 0 to 1)
pulsingObject = expandCircle(A3, 31 + (7 * pulsing), Corner[1], Corner[3], Corner[5])
numbersToShow = Zip(Text[If[Defined[valueswithIni(kk)], (("\phantom{p}" * valueswithIni(kk)) * "\hspace{10}"), ""], Centers(kk), true, true, 0, 0], kk, circlesVisibles)
fullTree: branchesFlat ≟ RemoveUndefined[branchesFlat]
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputCurrent ≟ RemoveUndefined[inputCurrent] ∧ fullTree
text1: "\textsf{\hspace{11}" + (LaTeX[If[correct1, "Encontraste los factores primos, pero el arbol tiene un problema.", If[correct3, "Solamente puede haber números primos en la base del árbol.", ""]]]) + "}"
solutionNumbers = Flatten({Text[(("\phantom{p}" * numberToFactor) * "\hspace{4.5}"), Element[solutionCenters, 1], true, true, 0, 0], Zip[Text[(("\phantom{p}" * AA) * "\hspace{10}"), Element[BB, 1], true, true, 0, 0], AA, sortedFactors, BB, Take[solutionCenters, 2]], Zip[Text[(("\phantom{p}" * AA) * "\hspace{10}"), Element[BB, 2], true, true, 0, 0], AA, sortedQuotients, BB, Take[solutionCenters, 2]]})
BottomEquation: "\math{" + (LaTeX[TableText[If[showsolution ∧ (¬yoursolution), m2, m1]]]) + "\\" + (LaTeX[If[showsolution ∧ (¬yoursolution), text1, ""]]) + "}"
labelBtnValidate: "\text{CHEQUEAR (" + (LaTeX[3 - tries]) + ")}"
textCountCorrect: "\text{Correctos: " + (LaTeX[countCorrect]) + " }"
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correcto}$", "$\text{✕ " + (If[tries < 3, "Reinténtalo", "Quizás la próxima vez"]) + "}$"]]) + ""
textHint: "\textsf{\color{" + (LaTeX[colorOrange]) + "}{\bold{Pista}}}\\\\" + (LaTeX[If[showhinttypicalerror, If[isTypicalError1, helpTextHintTypicalError, helpTextHintTypicalError2]]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + ""
labelBtnToggleSol: "\textsf{" + (LaTeX[If[yoursolution, "POSIBLE SOLUCIÓN", "TU SOLUCIÓN"]]) + "}"

Tool: PixelsToPoint
PixelsToPoint(Corner1,Corner3,Corner5,PixelCoords)
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputPoint

InputPixels: (100, 200)
xRight: x(Corner3)
xLeft: x(Corner1)
yTop: y(Corner3)
yBottom: y(Corner1)
yCoord: yTop - (y(InputPixels) / y(Corner5) * (yTop - yBottom))
xCoord: (x(InputPixels) / x(Corner5) * (xRight - xLeft)) + xLeft
OutputPoint: (xCoord, yCoord)

Tool: onboardingTextOffset
onboardingTextOffset(textCorner1,textCorner3,case,corner1,corner3,corner5)
Input: CornerText1, CornerText3, case, Corner1, Corner3, Corner5
Output: TextOffset

xPixels: ((x(CornerText3) - x(CornerText1)) * x(Corner5) / (x(Corner3) - x(Corner1)))
yPixels: ((y(CornerText3) - y(CornerText1)) * y(Corner5) / (y(Corner3) - y(Corner1)))
xOffset = Element({27, (-xPixels) + 2, 16 - xPixels / 2, 16 - xPixels / 2}, case)
yOffset = Element({-23, -23, yPixels - 27, -49}, case)
TextOffset: (xOffset, yOffset)

Tool: onboardingTextOffset (command onboardingTextOffset1)
onboardingTextOffset(textCorner1,textCorner3,case,corner1,corner3,corner5)
Input: CornerText1, CornerText3, case, Corner1, Corner3, Corner5
Output: TextOffset

xPixels: ((x(CornerText3) - x(CornerText1)) * x(Corner5) / (x(Corner3) - x(Corner1)))
yPixels: ((y(CornerText3) - y(CornerText1)) * y(Corner5) / (y(Corner3) - y(Corner1)))
xOffset = Element({27, (-xPixels) + 2, 16 - xPixels / 2, 16 - xPixels / 2}, case)
yOffset = Element({-23, -23, yPixels - 27, -49}, case)
TextOffset: (xOffset, yOffset)

Tool: expandCircle
expandCircle(A,pixelRadius,Corner1,Corner3,Corner5)
Input: A, pixelRadius, Corner1, Corner3, Corner5
Output: newEllipse

distanceX: (pixelRadius / x(Corner5) * (x(Corner3) - x(Corner1)))
distanceY: (pixelRadius / y(Corner5) * (y(Corner3) - y(Corner1)))
xyScale: distanceY / distanceX
pointGap: distanceX
cMinor = Min(pointGap, (pointGap * xyScale))
cMajor = Max(pointGap, (pointGap * xyScale))
f1: sqrt(cMajor^(2) - cMinor^(2))
A: (3, 4)
newEllipse = If(xyScale < 1, Ellipse[A + (f1, 0), A + ((-f1), 0), A + (cMajor, 0)], Ellipse[A + (0, f1), A + (0, (-f1)), A + (0, cMajor)])