Skip to content

About

This past summer I invented a factoring algorithm using trailing bits, I have been working on it

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Based-Factoring-Algorithm

This past summer I invented a factoring algorithm using trailing bits, I have been working on it

I try to compute the factors using trailing bits There are several ways to apporach this (ex. using variables/unknowns, using brute force, etc) No matter how you implement my algorithm it can be abstracted as a tree of 'all possible trailing bits of potential factors' My current version, (this program) uses a method similar to mathamatical induction

The problems: My 'tree' algorithm has a worst case of linear time complexity (which is very bad) My 'tree' algorithm guzzles storage

To address these problems I have found that 'trimming' the 'tree' correctly solves them

So far the best way to speed up the process is to trim the tree whenever we find a bit string that should not be there

Trimming methods: We can also 'trim' the tree if there is symmetry We can also 'trim' if the product of a*b>n

For example n=p*q, p and q are prime integers if we know that 001 does not appear in the bit string of p and q we can 'trim' the tree and dramatically speed up the Based-Factoring-Algorithm

Algorithm

convert N to binary Find the numbers that match the trailing k bits (using algebra, induction) f(n,k=1)->f(n,k=2)->f(n,k=3)->...->f(n,k=ceil(log_2(n)))

n=15 without trimming: (1,1) (01,11) (001,111) (0001,1111) (11,01) (011,101) (0011,0101) (101,011) (0101,0011) (111,001) (0111,1001) (1001,0111) (1011,1101) (1101,1011) (1111,0001)

n=15 with trimming exclude bit string '001; (symmetry) (exclude 001) (symmetry) (found answer) (exclude too big) (1,1) (01,11)
(011,101) (0011,0101) (101,011) (0101,0011)

(11,01)

(1,1) (101,011) (01,11) (001,111)

As we can see, trimming offers a dramatically faster convergence

But here is the problem: How do we know what bit strings to exclude if we don't know p&q?

Here is how I answer that question:

Terms I will use to describe a bit string: poisoned = the bitstring is contained in either p or q unpoisoned = the bitstring is not contained in either p or q Our goal is to find as many unpoisoned bit strings as possible

Ideally: The smaller the unpoisoned bit string the better since it can We don't need very many unpoisoned bit strings (even huge numbers can be factored by only knowing 6-7 bit unpoisoned bit strings)

Using my current 'tree' algorithm: I can tell with absolute certanty if a number is 'poisoned' iff all of the leaves of the tree contain that bit string I can NOT tell for sure if a bit string is unpoisoned I can test as many bit strings as I want simutaniously but my algorithm can only tell me if at least one bit string is poisoned (but with huge speedup)

My logic: create a small list of potential bit strings Determine a max storage (tree depth) to search Run the algorithm for all the bit strings if the algorithm determines some are poisoned, remove them from out set we then will run our algorithm on each pair of numbers If a pair is poisoned we need to make a (very accurate) judement call on which element of the pair is poisoned Keep going with triplets and quadruplets, etc until factors are found

WARNING In order for this algorithm to work, there must be no false positives If there is one false positive the algorithm fails

variables: max_size: THe mast storage for our tree The tree guzzles storage more=better the larger max size is, the more useful our is_poisoned function is If the tree excedes this size the algorithm returns inconclusive

possible_excludes: Our list of bit strings that we will try Does not need to be huge We don't know what is poisoned and what is not

excludes: we select items from possible_excludes to see if any of them are poisoned

Algorithm Abstraction

excludes-> algorithm-> poisoned or inconclusive poisoned = at least one item from excludes is poisoned (contained in one of the factors) inconclusive = The algorithm was unable to decide if the excludes list contained a poisoned bit string Increasing max_size reduces the rate of retuning inconclusive at the expense of time & memory

the more bit strings in excludes, it improves the accuacy of the algorithm at the expense of precision precision = knowing which bit string is poisoned accuracy = Knowing if an element is poisoned

if there is enough unpoisoned elements in the excludes array, then the algorithm very quickly calculates the factors It does not need to find every unpoisoned bit string only enough to speed the algorithm enough to find the factors in a reasonable amount of time

current task

The current difficulty is quickly determining if an element is poisoned my current strategy is to check to see if the number of tuples that contain more than half of n choose length since we expect to find the tuples with poisoned elements to be returned more frequently not 100% accurate since randomness can mess with this. You can accurately manually guess items to exclude

I have also been playing around to see if we can use some inferential statistics: for example: How many unpoisoned bit strings of a given bitlength should we expect for an arbitrary n of a particular bitlength Given one bit-string is poisoned, what is the probablity that a similar bit string is poisoned? How many unpoisoned bit strings do we need to get the necessary speedup that we need

Other ideas: Would manually splitting be faster (ex. like merge sort)

For example, instead of starting out with chooing 1, we choose half and then cut in half again since larger list sizes for exclude are faster

Dynamically changing the max_size to avoid redundency and put more effort into smaller exclude sizes

TLDR: k=# trailing bits to match N=pq if ab=N then ab (mod 2^k) = N (mod 2^k) We will use the contrapositive to check if a given trailing bit string is potentially valid if ab (mod 2^k) != N (mod 2^k) then a*b!=N

Our algorithm builds a tree of all potential trailing bit sequences of a given bit length We check N (mod 2^k) against the leaves of our tree to see if it is possible If it is not in the leaves of the tree then it is contained within the

About

This past summer I invented a factoring algorithm using trailing bits, I have been working on it

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages