Skip to main content
Forth->C
Source Link
Darren Stone
  • 5.2k
  • 1
  • 19
  • 27

C, 38

f(n){int m;while(++m*m<=n);return--m;}

Translation of my Forth submission. Slow but correct. O(√n). Tested on OS X (64 bit).

C, 38

f(n){int m;while(++m*m<=n);return--m;}

O(√n). Tested on OS X (64 bit).

C, 38

f(n){int m;while(++m*m<=n);return--m;}

Translation of my Forth submission. Slow but correct. O(√n). Tested on OS X (64 bit).

Source Link
Darren Stone
  • 5.2k
  • 1
  • 19
  • 27

C, 38

f(n){int m;while(++m*m<=n);return--m;}

O(√n). Tested on OS X (64 bit).