PiHex Library, written in Go, generates a hexadecimal number sequence in the number Pi in the range from 0 to 10,000,000.

PiHex

PiHex Library generates a hexadecimal number sequence in the number Pi in the range from 0 to 1.0e10000000. To calculate using "Bailey-Borwein-Plouffe" algorithm, instructions that was published by David H. Bailey September 17, 2006.

API documentation Go Report Card Mentioned in Awesome Go

Usage

An example of using the PiHex Library:

package main

import (
	"fmt"
	"github.com/claygod/PiHex"
)

func main() {
	pi := PiHex.New()
	fmt.Print("The first 9 digits of Pi (hexadecimal): ", pi.Get(0, 9))
}

Settings

In the configuration file, you can change the constant STEP. This constant determines the amount generated in one step numbers. The reduction leads to a constant increase in the operating time of the program.

Attention! This constant can not be more than 9! Limitation due to the 64-bit library architecture.

The configuration file config.go

Perfomance

To optimize the run-time program, highly loaded sections of the library are performed in parallel (4 goroutines).

API

Methods:

  • New - create a new PiHex
  • Get - receiving a sequence of hexadecimal digits starting at the specified position and in the right quantity.

Example:

pi := PiHex.New()
x :=  pi.Get(1000, 5)

Algorithm

The Bailey–Borwein–Plouffe formula (BBP formula) is a spigot algorithm for computing the nth binary digit of Pi using base 16 math. The formula can directly calculate the value of any given digit of π without calculating the preceding digits. The BBP is a summation-style formula that was discovered in 1995 by Simon Plouffe and was named after the authors of the paper in which the formula was published, David H. Bailey, Peter Borwein, and Simon Plouffe.

Implementation

Plays Library is based on the publication "The BBP Algorithm for Pi" of David H. Bailey on September 17, 2006: http://www.davidhbailey.com/dhbpapers/bbp-alg.pdf

Copyright © 2017-2020 Eduard Sesigin. All rights reserved. Contacts: [email protected]

Similar Resources

Subdomain scanner, asynchronous dns packets, use pcap to scan 1600,000 subdomains in 1 second

ksubdomain是一款基于无状态的子域名爆破工具,类似无状态端口扫描,支持在Windows/Linux/Mac上进行快速的DNS爆破,在Mac和Windows上理论最大发包速度在30w/s,linux上为160w/s。 hacking8信息流的src资产收集 https://i.hacking8

Dec 31, 2022

CLI tool for CIDR range operations (check, generate)

cidrchk A CLI tool to assist you with CIDR ranges and IPs. Install it You can download the latest binary for Linux (Intel and Arm), macOS, and Windows

Nov 27, 2022

Catch breakouts by opening positions based on the previous day's range. Popularized by Larry Williams.

Catch breakouts by opening positions based on the previous day's range. Popularized by Larry Williams.

Simple Cryptocurrency Breakout Strategy Catch breakouts by opening positions based on the previous day's range. Popularized by Larry Williams. Strateg

Sep 10, 2022

Go sqlite3 http vfs: query sqlite databases over http with range headers

sqlite3vfshttp: a Go sqlite VFS for querying databases over http(s) sqlite3vfshttp is a sqlite3 VFS for querying remote databases over http(s). This a

Dec 27, 2022

A Simple Range for Golang

go-range-base Simple Range for Golang For(func(int32)) package main import ( "fmt" gorng "github.com/gopherzz/go-range-base" ) func main() {

Jan 29, 2022

Get all the swap details within the block range

go-swap-statistics get all the swap details within the block range get started git clone https://github.com/huahuayu/go-swap-statistics.git cd go-swap

Jul 22, 2022

Simple utility to set the WSL2 subnet to a specific range

WSL subnet utility This is a small Go utility to set the WSL2 host and subnet. It achieves this by: deleting the existing WSL network creating a new o

Oct 22, 2022

Package trn introduces a Range type with useful methods to perform complex operations over time ranges

Time Ranges Package trn introduces a Range type with useful methods to perform c

Aug 18, 2022

S3pd - CLI utility that downloads multiple s3 objects at a time, with multiple range-requests issued per object

S3 Parallel Downloader CLI utility that downloads multiple s3 objects at a time,

May 13, 2022

Tiny go package for fetching high and low value of a stock for any given period range using kite connect historical data APIs.

Tiny go package for fetching high and low value of stock for any given period range using Kite connect Historical data APIs.

Apr 27, 2022

A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy.

A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy.

Fake-SMS A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a pr

Dec 31, 2022

A tool to determine the highest version number that's smaller than a target version number

semver-highest A tool to determine the highest version number that's smaller than a target version number. Installation go install github.com/marten-s

Oct 13, 2021

A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy

A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy

Fake-SMS A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a pr

Dec 31, 2022

Converts a number to its English counterpart. Uses arbitrary precision; so a number of any size can be converted.

Converts a number to its English counterpart. Uses arbitrary precision; so a number of any size can be converted.

Dec 14, 2021

Iran National Id, Bank Card Number, Mobile Number Validator for golang

Iran IDValidator Iran National Id, Bank Card Number, Mobile Number Validator for golang Installation go get -u github.com/mohammadv184/idvalidator Us

Dec 20, 2021

Divide (distribute) the given number (n) into number (p) of parts randomly,

Number Split Randomly The sample code written in Go lang Executables This repo already have executables for Linux and windows, after clone the repo ju

Feb 4, 2022

Using NFP (Number Format Parser) you can get an Abstract Syntax Tree (AST) from Excel number format expression

NFP (Number Format Parser) Using NFP (Number Format Parser) you can get an Abstract Syntax Tree (AST) from Excel number format expression. Installatio

Feb 4, 2022

Toy project to test golang toolset, using as pretext the "cyclic number" problem (famous 142857 number)

go-cyclic-number Toy project to test golang toolset, using as pretext the "cyclic number" problem (famous 142857 number) First version: https://github

Feb 12, 2022

Sequence-based Go-native audio mixer for music apps

Mix https://github.com/go-mix/mix Sequence-based Go-native audio mixer for music apps See demo/demo.go: package main import ( "fmt" "os" "time"

Dec 1, 2022
Comments
  • Seems to give incorrect hexadecimal digits starting with the 3,708th

    Seems to give incorrect hexadecimal digits starting with the 3,708th

    I noticed while computing something with PiHex that it disagreed with results from the Python package pigen. So I compared them both with the file pi_hex_1m.txt downloaded from pi2e.ch. This has been verified in published analysis so I think it is dependable.

    The first differing hexadecimal digit is 3708 after the decimal point, where PiHex gives 6 and the file has 7. In total there are 42 differing digits in the first 100,000.

An ordinary differential equation solving library in golang.

ode An ordinary differential equation solving library in golang. Features Multi-dimensional state vector (i.e. extended states) Channel based stopping

Oct 19, 2022
tiny linear interpolation library for go (factored out from https://github.com/sgreben/yeetgif)

piecewiselinear A tiny library for linear interpolation. O(log(N)) per evaluation for N control points. import "github.com/sgreben/piecewiselinear" Ge

Sep 27, 2022
A well tested and comprehensive Golang statistics library package with no dependencies.

Stats - Golang Statistics Package A well tested and comprehensive Golang statistics library / package / module with no dependencies. If you have any s

Dec 26, 2022
2D triangulation library. Allows translating lines and polygons (both based on points) to the language of GPUs.
2D triangulation library. Allows translating lines and polygons (both based on points) to the language of GPUs.

triangolatte 2D triangulation library. Allows translating lines and polygons (both based on points) to the language of GPUs. Features normal and miter

Dec 23, 2022
There are 1,000,000 uatoms in an atom, a fact which I frequently forget and/or second-guess.

There are 1,000,000 uatoms in an atom, a fact which I frequently forget and/or second-guess. This repo contains a lot of programming to save myself a little bit of remembering.

Nov 14, 2021
Hex dump and read values of files quickly and swiftly with Go-Hex a program designed to dump any file in a hexadecimal format

Go-Hex Hex dump and read values of files quickly and swiftly with Go-Hex a program designed to dump any file in a hexadecimal format Dump Hashes ----

Oct 10, 2021
A package for Go that can be used for range queries on large number of intervals

go-stree go-stree is a package for Go that can be used to process a large number of intervals. The main purpose of this module is to solve the followi

May 14, 2022
Guess-number-game - Computer thoughts of some integer number, you must guess it with limited number of attempts
Guess-number-game - Computer thoughts of some integer number, you must guess it with limited number of attempts

Guess number game Rules Computer has thought of some integer number. You must guess it, you have numberOfAttempts attempts. How to run Just type in co

Dec 31, 2021
MNA - stands for mobile number assignment - a small zero external dependency golang library that is used to identify mobile number assignment in tanzania

MNA - stands for mobile number assignment - a small zero external dependency golang library that is used to identify mobile number assignment in tanzania

Nov 29, 2021
goworker is a Go-based background worker that runs 10 to 100,000* times faster than Ruby-based workers.

goworker goworker is a Resque-compatible, Go-based background worker. It allows you to push jobs into a queue using an expressive language like Ruby w

Jan 6, 2023