project-euler-solutions/C/projecteuler.h
Daniele Fucini a0c155d58c
Add more solutions
Added solution for problems 102 and 124 in C, for problem 104
in python and for problem 145 in both C and python.
2019-10-03 12:25:49 +02:00

33 lines
1.2 KiB
C

#ifndef _PROJECTEULER_INCLUDED
#define _PROJECTEULER_INCLUDED
#include <gmp.h>
int is_prime(long int);
int is_palindrome(int num, int base);
int is_palindrome_mpz(mpz_t n, int base);
long int gcd(long int a, long int b);
long int lcm(long int a, long int b);
long int lcmm(long int *values, int n);
int *sieve(int n);
int count_divisors(int n);
int find_max_path(int **triang, int n);
int sum_of_divisors(int n, int proper);
void swap(void **vet, int i, int j);
void insertion_sort(void **array, int l, int r, int (*cmp)(void *lv, void *rv));
void quick_sort(void **array, int l, int r, int (*cmp)(void *lv, void *rv));
int next_permutation(void **perm, int n, int (*cmp)(void *a, void *b));
int is_pandigital(int value, int n);
int is_pentagonal(long int n);
int *build_sqrt_cont_fraction(int i, int *period, int l);
int pell_eq(int i, mpz_t x);
int is_semiprime(int n, int *p, int *q, int *primes);
int phi_semiprime(int n, int p, int q);
int phi(int n, int *primes);
long int partition_fn(int n, long int *partitions, int mod);
int partition_fn_mpz(int n, mpz_t res, mpz_t *partitions);
int dijkstra(int **matrix, int **distances, int m, int n, int up, int back, int start);
int radical(int n, int *primes);
#endif