diff options
author | jonsykkel <jonrevold@gmail.com> | 2020-04-02 21:22:54 +0200 |
---|---|---|
committer | jonsykkel <jonrevold@gmail.com> | 2020-04-02 21:22:54 +0200 |
commit | 6a967f763e620350f1938194323ca1e8abfda1b6 (patch) | |
tree | 23fd63b95b34f6ca717d013765280b92bc92f588 | |
parent | 45fc6d309612988b4c930e47a27bfe36e77a9731 (diff) | |
download | ct_sequence-6a967f763e620350f1938194323ca1e8abfda1b6.tar.gz |
vork
-rw-r--r-- | makefile | 2 | ||||
-rw-r--r-- | src/main.c | 25 |
2 files changed, 20 insertions, 7 deletions
@@ -1,6 +1,6 @@ #version 5 -out_name := out +out_name := numper build := release tmp_dir := tmp bin_dir := bin @@ -4,24 +4,37 @@ #include <string.h> //#define MAX 100000000 -#define MAX 5000000000 +//#define MAX 5000000000 static void primt(uint64_t x,uint64_t t){ - printf("%lld: %lld\n",x+1,t); + //printf("%llu: %llu\n",x+1,t); + printf("%llu\n",t); } int main(int argc,char **argv){ uint64_t *h; uint64_t t; + uint64_t max; + + if(argc < 2){ + printf("usake: numper <num>\n"); + return 1; + } + + max = strtoull(argv[1],0,10); + printf("%llu\n",max); //h = malloc(sizeof(uint32_t)*MAX); - h = calloc(sizeof(uint64_t)*MAX,1); - if(!h) return 1; + h = calloc(sizeof(uint64_t)*max,1); + if(!h){ + printf("failed to allogate mamorY\n"); + return 1; + } //memset(h,0xFF,sizeof(uint32_t)*MAX); t = 0; - for(uint64_t x = 1;x < MAX;x++){ + for(uint64_t x = 1;x < max;x++){ /* if((int32_t)h[t] >= 0){ n = x-h[t]; @@ -39,7 +52,7 @@ int main(int argc,char **argv){ t = z & (x+ht); } - primt(MAX-1,t); + primt(max-1,t); return 0; } |