Skip to content

Instantly share code, notes, and snippets.

View aapokiiso's full-sized avatar

Aapo Kiiso aapokiiso

View GitHub Profile
@aapokiiso
aapokiiso / optimalfactors.c
Created March 23, 2016 19:09
Find optimal factors for number, with a specified largest acceptable factor. Used to find best possible (realistic, in my case 1:7) gear ratio for spinning a telescope in sidereal time (~86164 seconds).
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#define FACTOR_LIMIT 100 // Supports atm max 100 factors.
void die(const char *message)
{
if (errno) {
perror(message);