This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
WhiteDwarf


Newbie


Joined: 10 Nov 2003
Posts: 19

Posted: 15 Nov 2003 01:19:54 pm    Post subject:

I have a lil challenge for everybody create a factoring program with A as the input, and the shortest code wins.....the range has to be integers

I came up with


Code:
: Input A
: For(X,1,A
: A/X->B
: fPart(B ->C
: Disp B(C=0
: End


one problem with my code if it comes up with a floating point value it displays 0


Last edited by Guest on 15 Nov 2003 01:29:52 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 15 Nov 2003 03:26:28 pm    Post subject:

So it has to be the smallest in size, even if it takes longer to use? That is kind of stupid, since a longer program might work much faster. Anyway,


Code:
:Input A
:For(X,1,A
:If not(fPart(A/X
:Disp X
:End


That is 31 bytes, including the 1-letter name. Another 2 bytes might be saved by using :Disp Xnot(fPart(A/X.

on a calc w/Omnicalc:


Code:
:Input A
:factor(A


16 bytes. Less is impossible.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 15 Nov 2003 05:54:16 pm    Post subject:

28 bytes:

Code:
:Input A
:seq(Xnot(fPart(A/X)),X,1,A


Hard to read though, especially for large #s. Does not work for #s > 999.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 16 Nov 2003 01:33:30 pm    Post subject:

Sir Robin wrote:
on a calc w/Omnicalc:


:Input A
:factor(A


16 bytes. Less is impossible.

how is this even 16 bytes? the actual code is only 6! the program would have to have a 7 or 8 letter name!
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 16 Nov 2003 05:16:55 pm    Post subject:

I do not know why it's 16 bytes, but the program is named A, and the memory menu has it as 16 bytes large (no I did not mistake a variable for it). In Calcsys's VAT menu, its size is 0006, so 9 bytes are probably used to make it a program.

Last edited by Guest on 18 Nov 2003 07:04:29 pm; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement