Skip to main content
1 of 10
Kosatka
  • 121
  • 4

Brainlove, 73 bytes

Because brainfuck is too hard

>[[->+>+<<]>[<+>-]<-]>+++>-<<<+[>>[>-(<<<->>>~)<<+>-]<[>+<-]>++>>>+<<<<<] 

First computes the sum $$ S = \sum_{i=0}^n i = \frac{n(n+1)}{2} $$ and then the square root by find the largest n for which $$ \sum_{i=0}^n 2i-1 = n^2 < S $$ The error is always $$ E= \sqrt{\frac{n(n+1)}{2}}- \frac{n}{\sqrt{2}} < \sqrt{\frac{(n+\frac{1}{2})^2}{2}} - \frac{n}{\sqrt{2}} = \frac{n+\frac{1}{2}-n}{\sqrt{2}} = \frac{\sqrt{2}}{4} $$ and it is counteracted by rounding down. It is not very golfed, since I'm not very familiar with golfing in Brainlove/brainfuck, any improvements welcome (or a bf version). It should theoretically work for unbound cells, but I didn't have an option to test that.l

Kosatka
  • 121
  • 4