My idea is to have any number (lets say 20), and make a for i block that, when all the numbers in the for i are added, equal the number (20). So if I set the number to 55, the for i block should do “for i 1-10” because 1+2+3+… +10 = 55.
I want to be able to input any number and have the for i block get it right each time, but I have no idea what the math for that would even be.
The nth triangle number is n(n+1)/2. So if you’re given a number t and you want to find the smallest number n whose triangle number is \ge t, you get n^2 + n -2t = 0. Solve for n with the quadratic formula:
idk what to call it, so I just used untriangle from bh’s script
I started with the base definition of the primitive block (by right clicking it and clicking “edit” to see the definition), then tweaked it to make the value that’s checked is the total sum instead of the count.