my factorization algorythm

antonio gonzalez 136 Reputation points
2021-02-23T18:52:27.077+00:00

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

BRN441

Small BASIC
Small BASIC
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
    2021-03-07T12:25:37.313+00:00

    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
    2021-02-28T15:23:09.727+00:00

    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
    2021-02-28T18:43:12.883+00:00

    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
    2021-03-02T20:52:21.993+00:00

    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:

    PLQG647.000

    No comments

  4. antonio gonzalez 136 Reputation points
    2021-03-03T00:29:56.713+00:00

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

    FDZM212.000

    No comments