/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Author: Marco Vitetta
E-mail:
WebSite: http://ervito.altervista.org
*/
#include
#include
#include
#include
int is_integer(long double value);
int intcmp(const void *first, const void *second);
int main()
{
long long int hexagonal,i,n,pentagonals_array[100000],roots_array[10],roots_number=0,triangle;
for(n=2;n<100000;n++)
{
pentagonals_array[roots_number]=n*(3*n-1)/2;
if( is_integer( sqrtl(1+8*pentagonals_array[roots_number]) ) )
{
roots_array[roots_number]=sqrtl(1+8*pentagonals_array[roots_number]);
roots_number++;
}
}
for(n=0;n0 && string[index]=='0';);
if(string[index]=='.')
return 1;
return 0;
}