|
Project Euler Solutions
|
#include <primes.h>


Public Member Functions | |
| prime_factor_counter | prime_factors (uintmax_t n) |
| The base constructor for the prime factors iterator. More... | |
Public Attributes | |
| uintmax_t | target |
| The current target for prime factorization. More... | |
| uintmax_t | current |
| The prime number most recently tested. More... | |
| prime_counter | pc |
| The prime number generator being used to test. More... | |
Public Attributes inherited from c::include::iterator::Iterator | |
| bool | exhausted: 1 |
| An indicator that the iterator has stopped. More... | |
| bool | started: 1 |
| An indicator that the iterator has started. More... | |
| bool | phase: 1 |
| An indicator that changes each time the iterator moves. More... | |
Private Member Functions | |
| void | free_prime_factor_counter (prime_factor_counter *pfc) |
| The destructor for the prime factor generator. More... | |
| uintmax_t | advance_prime_factor_counter (prime_factor_counter *pfc) |
| The function to advance a prime factor iterator. More... | |
Private Attributes | |
| uintmax_t(*const | iterator_function )(prime_factor_counter *it) |
| The pointer to the iteration function. More... | |
| void(*const | destructor )(void *it) |
| The pointer to the destructor function. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| uintmax_t | is_composite (uintmax_t n) |
| Tells you if a number is composite, and if so, its smallest prime factor. More... | |
| bool | is_prime (uintmax_t n) |
| Tells you if a number is prime. More... | |
Related Functions inherited from c::include::iterator::Iterator | |
| #define | IteratorTail(return_type, struct_type) |
| The base definition macro for all iterators in this project. More... | |
| #define | IterationHead(it) |
| The base macro for all iteration functions in this project. More... | |
| #define | IteratorInitHead(advance, ...) {.iterator_function = &advance, AddDestructor(no_destructor), __VA_ARGS__} |
| The base macro for all iterator initialization functions in this project. More... | |
| #define | AddDestructor(func) ExtendInit(destructor, (void (*const)(void *)) &func) |
| The extension macro for initializing Iterators with a destructor. More... | |
| #define | ExtendInit(name, value) .name = value |
| The extension macro for initializing more complicated Iterators. More... | |
| #define | next(state) (*(state.iterator_function))(&state) |
| The macro to advance generic iterators. More... | |
| #define | next_p(state) (*(state->iterator_function))(state) |
| The macro to advance generic iterator pointers. More... | |
| #define | free_iterator(it) (*(it.destructor))(&it) |
| The generic destructor for iterators. More... | |
| #define | free_iterator_p(it) (*(it->destructor))(it) |
| The generic destructor for iterator pointers. More... | |
The iterator that allows you to prime factorize a number
|
private |
The function to advance a prime factor iterator.
| i | the counter you want to advance |
-1
|
private |
The destructor for the prime factor generator.
| prime_factor_counter prime_factors | ( | uintmax_t | n | ) |
The base constructor for the prime factors iterator.
| n | The non-zero number you wish to factor |

|
related |
Tells you if a number is composite, and if so, its smallest prime factor.
| n | The number you wish to test |
|
related |
Tells you if a number is prime.
| n | The number you wish to test |
| uintmax_t c::include::primes::prime_factor_counter::current |
The prime number most recently tested.
|
private |
The pointer to the destructor function.
|
private |
The pointer to the iteration function.
| prime_counter c::include::primes::prime_factor_counter::pc |
The prime number generator being used to test.
| uintmax_t c::include::primes::prime_factor_counter::target |
The current target for prime factorization.
1.8.11