Skip to content

This project plays with the mathematical topics of "Multiplicative digital roots" and "Multiplicative Persistence"

License

Notifications You must be signed in to change notification settings

centic9/MultiplicativeDigitalRoot

Repository files navigation

Build Status Gradle Status

This project plays with the mathematical topics of "Multiplicative digital roots" and "Multiplicative Persistence", see https://en.wikipedia.org/wiki/Multiplicative_digital_root and https://en.wikipedia.org/wiki/Persistence_of_a_number for more information.

It determines the smallest number for each multiplicative persistence using Java and BigInteger or byte-arrays, exploring limits of handling large numbers with BigIntegers and comparing performance to other approaches.

Theory

There is a conjecture that there is no multiplicative persistence of a number higher than 11

See https://oeis.org/A007954 and https://oeis.org/A003001 for related mathematical series

More information on this topic:

Code

This project currently implements two ways of computing the multiplicative persistence of numbers.

The first version at MultiplicativeDigitalRoot uses Strings and BigIntegers to handle large numbers, but this is obviously rather inefficient and limits the number of checks that can be performed.

The second version at MultiplicativeDigitalRootByteArray represents the digits of the number in a byte-array which allows to perform some of the operations much quicker. It also optimizes incrementing the number a lot to check much less numbers and skip large sections of numbers that are not relevant anyway.

The third version at MultiplicativeDigitalRootClass is similar to the previous one but extracts code into a class ByteArrayInteger which encapsulates the handling of

Change it

Grab it

git clone https://github.com/centic9/MultiplicativeDigitalRoot.git

Build it and run tests

cd MultiplicativeDigitalRoot
./gradlew check jacocoTestReport

Licensing

About

This project plays with the mathematical topics of "Multiplicative digital roots" and "Multiplicative Persistence"

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages