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 Brain Teasers => TI-BASIC
Author Message
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 15 Jul 2007 07:21:14 am    Post subject:

I have a good one! (I think... you math geniuses might prove me wrong):

Make a program to find the amount of three digit numbers you can make from a set of numbers stored in L1 and output them into L2.


Last edited by Guest on 15 Jul 2007 07:34:44 am; edited 1 time in total
Back to top
Xphoenix


Elite


Joined: 04 Apr 2007
Posts: 756

Posted: 15 Jul 2007 12:16:36 pm    Post subject:

Can there be repeats of numbers in L1?
Back to top
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 15 Jul 2007 02:23:05 pm    Post subject:

Nope.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 15 Jul 2007 02:57:59 pm    Post subject:

What is the range of each element in the set?

Last edited by Guest on 15 Jul 2007 03:48:06 pm; edited 1 time in total
Back to top
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 15 Jul 2007 03:41:20 pm    Post subject:

0-9.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 15 Jul 2007 03:43:18 pm    Post subject:

Do you want us to actually compose and store the possible three-digit numbers to [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]L2?

Additionally, 359 and 395 would be two different results, correct?

Last edited by Guest on 15 Jul 2007 03:47:41 pm; edited 1 time in total
Back to top
Xphoenix


Elite


Joined: 04 Apr 2007
Posts: 756

Posted: 15 Jul 2007 03:51:09 pm    Post subject:

If the range is only 0-9 (single digit numbers), then it's
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]dim(L1
Ans(Ans-1)(Ans-2

for no zeros, or
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]dim(L1
Ans(Ans-1)(Ans-2)-1
for one zero. I think. But it's different if the range allows for two and three digit numbers.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 15 Jul 2007 03:54:12 pm    Post subject:

Xphoenix wrote:
If the range is only 0-9 (single digit numbers), then it's
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]dim(L1
Ans(Ans-1)(Ans-2
Or, [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]dim(L1) nPr 3.

Getting the number of permutations is easy, but actually forming them is a tad more difficult.

Last edited by Guest on 15 Jul 2007 03:55:33 pm; edited 1 time in total
Back to top
Xphoenix


Elite


Joined: 04 Apr 2007
Posts: 756

Posted: 15 Jul 2007 04:11:30 pm    Post subject:

He actually hasn't requested that we make them, and it's not too difficult, just difficult to do it quickly.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 15 Jul 2007 04:16:03 pm    Post subject:

Assuming that we do:
Spoiler wrote:
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]{0
For(A,1,dim(L1
For(B,1,dim(L1
For(C,1,dim(L1
If A≠B and A≠C and B≠C
augment(Ans,{E2L1(A)+10L1(B)+L1(C
End:End:End
cumSum(ΔList(Ans

Simple enough. I think there's a smaller way to do that test, though.

I hope I don't get disqualified for not using [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]L2
.

Last edited by Guest on 15 Jul 2007 04:21:06 pm; edited 1 time in total
Back to top
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 15 Jul 2007 07:52:13 pm    Post subject:

Alright to go over it again. The results should be in L2 (yes 359 and 395 are different) and the number of results should be in Ans. The range of the numbers in L1 is 0-9 with no repeats.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 15 Jul 2007 09:27:10 pm    Post subject:

Spoiler wrote:
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]{0
For(A,1,dim(L1
For(B,1,dim(L1
For(C,1,dim(L1
If A≠B and A≠C and B≠C
augment(Ans,{E2L1(A)+10L1(B)+L1(C
End:End:End
cumSum(ΔList(Ans→L2
[s]dim(L1) nPr 3[/s] dim(Ans
[s]Ninety-eight[/s] Ninety-four bytes.

Last edited by Guest on 15 Jul 2007 09:40:42 pm; edited 1 time in total
Back to top
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 15 Jul 2007 09:44:09 pm    Post subject:

Weregoose wrote:
Spoiler wrote:
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]{0
For(A,1,dim(L1
For(B,1,dim(L1
For(C,1,dim(L1
If A≠B and A≠C and B≠C
augment(Ans,{E2L1(A)+10L1(Cool+L1(C
End:End:End
cumSum(ΔList(Ans→L2
[s]dim(L1) nPr 3[/s] dim(Ans
[s]Ninety-eight[/s] Ninety-four bytes.
[post="110136"]<{POST_SNAPBACK}>[/post]


Thats just about what I had.
Back to top
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 16 Jul 2007 06:44:39 am    Post subject:

[s]Except... its only supposed to do three digit numbers.[/s] Scratch that. It only happened because I had a zero in L1.

Last edited by Guest on 16 Jul 2007 06:47:15 am; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 16 Jul 2007 01:46:57 pm    Post subject:

It shouldn't matter as long as you use an algorithm to perform extraction from right to left. If there's a 31 in your list of three-digit numbers, then you'll get a 1, then a 3, and finally the preceding 0—all numbers obtained.

Last edited by Guest on 16 Jul 2007 01:48:03 pm; edited 1 time in total
Back to top
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 16 Jul 2007 01:48:44 pm    Post subject:

I still can't figure out a way to make it so that when you have zero in L1 and it is put as the last value in a number it doesn't disappear.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 16 Jul 2007 01:58:30 pm    Post subject:

justusdude wrote:
I still can't figure out a way to make it so that when you have zero in L1 and it is put as the last value in a number it doesn't disappear.
Define "last" and give an example of what you want.
Back to top
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 16 Jul 2007 02:40:56 pm    Post subject:

Ex:

L1={2,0,1}

L2={201,21,102,12}

This is what happened on my calc.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 16 Jul 2007 03:45:49 pm    Post subject:

The result should be [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]{201,210,21,12,120,102}—twelve and twenty-one have preceding zeros.

Try plugging each element into [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]int(10fPart(value10^(seq(X,X,‾3,‾1...

201: [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]{2,0,1}
210: [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]{2,1,0}
21: [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]{0,2,1}
...

Last edited by Guest on 16 Jul 2007 03:46:05 pm; edited 1 time in total
Back to top
justusdude


Advanced Member


Joined: 24 May 2006
Posts: 265

Posted: 16 Jul 2007 05:28:00 pm    Post subject:

Ahh, my mistake.

But... what if I decided to, oh I don't know, say you couldn't have preceding zeros?

Because I have.

MWAHAHAHAHA!!!
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
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are UTC - 5 Hours

 

Advertisement