my factorization algorythm

antonio gonzalez 136 Reputation points

its a pretty simple method:

if the number to factorize ends in 9 i know one of its factors its gonna end on 1 3 7 or nine

a 4 or a 2 is not posible

so i iterate through all posible two digits number attached to 1 3 7 or 9 multiplied by another number from zero to nine and select only those whos product termination match the original number and go on like that till the begining of the number


A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
261 questions
{count} votes

Accepted answer
  1. WhTurner 1,596 Reputation points

    Some observations:

    • You have 4 subroutines in your program which are not used, (not critical but unnessesary)
    • in Sub comienzo you loop from 2 to 9 which excludes number ending in a 1, so 121 cannot be factorised,
      changing the loops from into 1 to 9 solves this.
    • you calculate in these loops b (64 or 81 times), this is always the same, put that before the loops.
    No comments

5 additional answers

Sort by: Most helpful
  1. antonio gonzalez 136 Reputation points

    theres something i did wrong in my previous program and im not sure what

    im onto a factorizing method that i think compromises rsa encryption security, do you think i could get in trouble if i was right?

    ill elaborate on my method:

    imagine you want to factorize the number 121, by its termination you know one of its factos its gonna end in 1,3,7 or 9, the rest of terminations are just not posible so im starting to siege

    i make a for so i test all numbers from zero to nine like 01,11,21,31,41...,03,13,23,33,...

    and i go on comparing terminations 11*01=11, termination dont match eliminated, 11*11=121, teminations match so 11 its a candidtae

    on next iteration ill try 011,111,211,311...

    011 is a winner

    No comments

  2. WhTurner 1,596 Reputation points

    How fast is your algorithm?
    Can you factirize the number 1956410986640441413344189841
    I hav a program that does this in 0.062 seconds

  3. antonio gonzalez 136 Reputation points

    im still trying to figure out how fast is my algorythm

    this one is better but it still fails for some numbers im figuring out why:


    No comments

  4. antonio gonzalez 136 Reputation points

    the previous program was bugged this is an improved version but still have to polish:


    No comments