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.
280 questions
{count} votes

Accepted answer
  1. WhTurner 1,611 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.
    1 person found this answer helpful.
    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. antonio gonzalez 136 Reputation points
    2021-03-04T23:43:14.977+00:00

    this one is instantaneous but i still can not make it work for all numbers

    CLGN16.000

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.