This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ContinuedFractions { | |
public static void main(String[] args) { | |
double[] e_cf = {2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,1,1,14}; | |
System.out.println(cf(e_cf)); | |
System.out.println(Math.E); | |
} | |
// optionally pass the index value and do not copy the tail array every time | |
public static double cf(double... d) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.BorderLayout; | |
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.GridLayout; | |
import java.awt.Toolkit; | |
import java.awt.datatransfer.Clipboard; | |
import java.awt.datatransfer.StringSelection; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Rooting { | |
public static void main(String[] args) { | |
System.out.println(next(1000, 2)); | |
System.out.println(Math.sqrt(2)); | |
} | |
public static double next(int n, double r) { | |
if (n <= 0) return 1; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Partition { | |
private double a; | |
private double b; | |
private double N; | |
public Partition(double a, double b, double N) { | |
super(); | |
this.a = a; | |
this.b = b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a script to find a solution to Calculator: The Game | |
// https://play.google.com/store/apps/details?id=com.sm.calculateme | |
function add(a) { | |
return { | |
apply: function(b) { | |
return a + b; | |
}, | |
info: 'add ' + a | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
QVMDisas.py | |
Created by Macpunk on 2009-09-20. | |
Updated by GrosBedo on 2010-04-12 | |
Copyright (c) 2009 Dalton M. Cummings. All rights reserved. | |
CHANGELOG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.PriorityQueue; | |
public class DiceGame { | |
/* | |
* We are playing a dice game. | |
* Player A plays with 2 dice. | |
* Player B plays with 3 dice. | |
* Player A adds up the eyes of both rolls. | |
* Player B chooses the two highest and adds up these. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Mintos | |
// @namespace Mintos | |
// @include https://www.mintos.com/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
$(document).ready(function() { | |
let profit = $("#mintos-boxes")[0].childNodes[1].childNodes[0].childNodes[1].childNodes[0].childNodes[5].childNodes[1].childNodes[0].data; | |
document.title = profit + " | " + document.title; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def abschreiber(n): | |
ab = [0] * n | |
for i in range(0, n): | |
b = random.choice([-1, 1]) | |
ab[(i+b) % n] += 1 | |
ab = list(filter(lambda x: x == 0, ab)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WeirdEuler { | |
public static int N = 1000000; | |
public static double ak(int k) { | |
if (k == 0) return 2; | |
double product = 1; | |
for (int i = k; i < 2*k; i+=2) { | |
product *= ((double) (i+2)) / (i+1); | |
} |