All pastes #2034789 Raw Edit

dpecka

public c v1 · immutable
#2034789 ·published 2010-12-31 03:28 UTC
rendered paste body
/* sample example:*	having inane equation n(n+sqrt(n))=L where:*	n increments as m=1; n=(++m)**2 .. so only integers are used*	the highest value of sqrt(n) is FFFF (255) so n could be up to 255**2**	you're getting L and need to determine n*	in example below we increments n and break() until we reach equality with L**	is it bloody correct ??*/#include <stdio.h>#include <math.h>unsigned main(void) /* also debug, it won't be main but something like `unsigned foo(double L)` */{	unsigned m, n, l;	m = n = 1;	l = pow(255, 2);	unsigned long long L = 2029491264;		for(n = 1; n <= l; n = pow(++m, 2)) {		if(n * (n + sqrt(n)) == L)			break;	};	printf("%u\n", n); /* just only for debug to can chec number */	return(n);}