Skip to content

Unable to test deterministically #1

Open
@chaitannah

Description

I tried to utilize your code to optimize primality testing, but I am unable to determine what is going wrong as it has an accuracy of roughly 0.6 when determining if a composite number is prime or not.

Here is my C code :

#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>

#if defined(__MSC_VER) || _MSC_VER >= 1800
#include<inttypes.h> //for visual studio compatibility
#else
#define PRIu64 "llu"
#endif

#ifdef _MSC_VER
#define inline __inline
#endif

#include "sprp64.h"

#include "myPrimeCode.c"

//3 bases are enough for all numbers below 2^64
#define BASES_CNT 7

const uint64_t bases64[] = {2, 325, 9375, 28178, 450775, 978054, 1795265022};

int main() {
for (int i = 2; i < 10e3; i++) {
if (!prime(i))
printf("%d %d\n", i, efficient_mr64(bases64, BASES_CNT, i));
}
return 0;
}

Would appreciate your help 👍

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions