#include /* This tool computes the sequence A230127 in the OEIS (and its natural generalization where |x| > s for some fixed positive integer s). s = 1 corresponds to the sequence A230127 and s = 2 corresponds to the sequence A229614. Author: Nathaniel Johnston (nathaniel@njohnston.ca) Version: 1.00 Last Updated: Oct. 10, 2013 */ unsigned char dig[64]; unsigned int ct,n,s; void extract_binary(unsigned long int curI); unsigned char check_no_square(); int main() { long long int i; printf("This tool computes the sequence A230127 in the OEIS (and its natural generalization where |x| > s).\n\nPlease enter s (s >= 1): "); scanf("%d",&s); printf("\n"); s = s+1; for(n=1; n<64; n++){ ct = 0; for(i=(2<<(n-1))-1; i>=0; i--){ extract_binary(i); ct += check_no_square(); } printf("%d, ", ct); } return 0; } void extract_binary(unsigned long int curI) { unsigned char j; for(j=0; j>1; } } unsigned char check_no_square() { unsigned char k,p,m,is_dup; for(k=s; k<=n/2; k++){ for(p=0; p<=n-2*k; p++){ is_dup = 1; for(m=0; m