Skip to content

Instantly share code, notes, and snippets.

@peria
peria / chudnovsky.cc
Last active Feb 22, 2020
DRMを利用した円周率計算 (Zの計算フラグの導入)
View chudnovsky.cc
#include "computer.h"
void Chudnovsky::setXYZ(int64_t k, mpz_class& x, mpz_class& y, mpz_class& z) {
static constexpr int64_t A = 13591409;
static constexpr int64_t B = 545140134;
static constexpr int64_t C = 640320;
if (k == 0) {
x = 1;
} else {
@peria
peria / largest_dpn_for_each.cc
Created Dec 11, 2016
枚数毎の最大素数大富豪素数を求めるプログラムです
View largest_dpn_for_each.cc
#include <gmpxx.h>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
using namespace std;
@peria
peria / largest_dpn.cc
Last active Feb 22, 2016
Check if the largest prime number in Prime-Daifugo can have 71 digits?
View largest_dpn.cc
#include <gmpxx.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const char* ranks[] = {"", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"};