Git Product home page Git Product logo

regularnumgen's Introduction

Regular Number Generator

A few functions for generating the Nth regular number

Regular numbers, also known as ugly numbers, Hamming numbers, and 5-smooth numbers, are numbers whose only prime divisors are 2, 3, and 5.

They are described by 2^i * 3^j * 5^k for non-negative i,j,k

The first 15 regular numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24

While that might make it look like regular numbers are densely distributed, they are not. After around 60, the ratio of regular numbers to non-regular (normal? irregular?) numbers decreases precipitously, and they are very sparse among larger integers.

Because they are dependent on the distribution of primes, regular numbers are randomly distributed throughout number space, and cannot be predicted analytically. The sparseness of their distribution highlights the importance of algorithmic scaling.

The functions contained here will calculate the Nth regular number. In order from slowest to fastest:

get_regular_factor(N)
get_regular_set(N)
get_regular_log_set(N)
get_regular_compact(N)
get_regular_divide_conquer(N)
get_regular_fast_geometric(N)

This code requires a C++17 compiler. To build it, clone this repo

git clone https://github.com/jbeisman/RegularNumGen

Then enter the directory and invoke the build script

cd RegularNumGen
sh build.sh

And run the executable

./install/bin/RegNumGen

regularnumgen's People

Contributors

jbeisman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.