Loading ...
Sorry, an error occurred while loading the content.

Prime pair factoring program

Expand Messages
  • benjimon2007b
    Below is a little program for factoring prime pairs. It should be noted that it is quite slow and doesn t always work as it sometimes get s stuck in cycle.
    Message 1 of 1 , Mar 11, 2007
    • 0 Attachment
      Below is a little program for factoring prime pairs.
      It should be noted that it is quite slow and doesn't always work as
      it sometimes get's stuck in cycle. Hopefully someone may find some
      use for it.

      10 ' basic factoring method 3
      20 Numtf=1709023
      30 Bn=int(sqrt(Numtf))
      40 Numtwo=Bn
      50 gosub 500
      60 if Numtf@Numtwo=0 then goto 1000
      70 if Numtf@Numrem=0 then goto 1000
      80 if Numtwo<Bn then gosub 500
      90 if Numtwo>Bn then gosub 600
      100 goto 60
      499 ' 500 is to add if less
      500 Numrem=Numtf@Numtwo
      510 Newnum=Numtwo+Numrem
      515 Numtwo=Newnum
      520 return
      599 ' 600 is to subtract if more
      600 Numrem=Numtf@Numtwo
      610 Newnum=Numtwo-Numrem
      615 Numtwo=Newnum
      620 return
      1000 print "SOLVED":beep:beep
      1010 print Numtwo:print:print Numrem
      OK

      Change the value in line 20 to look for factors of other numbers.
    Your message has been successfully submitted and would be delivered to recipients shortly.