Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prime factors in 25 lines or less
#16
Nice, methinks you could probably create some sort of string with the values of the first X primes to speed it up too.. or something.

Latest:
Code:
CLS
INPUT "What is the number you want to factor"; testfactor&
DO
redoloop1:
FOR testdiv& = 2 TO testfactor& ^ .5
result1& = testfactor& \ testdiv&
IF result1& = testfactor& / testdiv& THEN
print testdiv&;
testfactor& = result1&
goto redoloop1
END IF
NEXT testdiv&
exit do
loop
print testfactor&;
SLEEP
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply


Messages In This Thread
Prime factors in 25 lines or less - by whodat - 10-07-2005, 10:21 PM
Prime factors in 25 lines or less - by Agamemnus - 10-08-2005, 07:05 AM
from an ageing newbie - by whodat - 10-09-2005, 02:41 AM
Prime factors in 25 lines or less - by Agamemnus - 10-09-2005, 02:49 AM
Prime factors in 25 lines or less - by whodat - 10-09-2005, 03:08 AM
Prime factors in 25 lines or less - by neuro - 10-09-2005, 03:35 AM
Prime factors in 25 lines or less - by speedlemon - 10-09-2005, 03:51 AM
Prime factors in 25 lines or less - by Agamemnus - 10-09-2005, 04:11 AM
Prime factors in 25 lines or less - by whodat - 10-09-2005, 05:41 AM
I like it - by whodat - 10-09-2005, 05:57 AM
Am I doing something wrong? - by whodat - 10-09-2005, 06:06 AM
Prime factors in 25 lines or less - by rpgfan3233 - 10-09-2005, 10:27 AM
Prime factors in 25 lines or less - by d.j.peters - 10-09-2005, 11:17 PM
Prime factors in 25 lines or less - by Agamemnus - 10-10-2005, 01:43 AM
Prime factors in 25 lines or less - by whodat - 10-10-2005, 02:01 AM
Prime factors in 25 lines or less - by Agamemnus - 10-10-2005, 02:13 AM
Prime factors in 25 lines or less - by whodat - 10-10-2005, 02:58 AM
Prime factors in 25 lines or less - by whodat - 10-10-2005, 03:04 AM
Prime factors in 25 lines or less - by Quibbler - 10-10-2005, 06:05 PM
Prime factors in 25 lines or less - by rpgfan3233 - 10-10-2005, 09:24 PM
Prime factors in 25 lines or less - by Quibbler - 10-10-2005, 09:37 PM
Prime factors in 25 lines or less - by Quibbler - 10-11-2005, 01:07 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)