just a logo :)


See as: raw | code

terms of service | imprint

is powered by m1d1

Evenly distribute things with rising frequency
(Entry Nr. 2640, by user 1 | edit)
Imagine you have 55 beans and you want to put them on 10 squares so that on square 1 there is 1 bean, on square 2 there are 2 beans, on square 3 there are 3 beans etc.

Now you might need a formula that takes bean_nr as input and provides square_nr as output. So it answers the question "hey, which square should I put bean nr 7 on?".

The formula is:

square_nr=Math.ceil((-1 + Math.sqrt(1 + 8*bean_nr))/2)
Create a new entry at this position