Skip to content

Instantly share code, notes, and snippets.

@Randl
Randl / fast_fibo.h
Created February 14, 2017 12:40
Calculate nth Fibonacci number
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <gmp.h>
/*
* from Fibo(n) = phi^n / sqrt(5) approximate number of bits in nth fibo
* is log_2(phi) * n - log_2(5)/2 For n >> 1, it's a bit less than 0.695n
*/
#define FIBO_BITCOUNT(x) ((mp_bitcnt_t)ceil(0.695 * (x)))
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();