Author |
Message |
|
luby I want to go back to Philmont!!
Calc Guru

Joined: 23 Apr 2006 Posts: 1477
|
Posted: 27 Jan 2008 08:08:11 pm Post subject: |
|
|
Here is a teaser. What is the smallest way you can get a matrix that exists in ans only to contain all 1 number?
For example, you run it and it returns a matrix like [[1,1,1,1][1,1,1,1]]
The matrix must be a 12*8 and you can't use any other matricies in order to make your matrix.
52 bytes is the bar. GO!
Last edited by Guest on 27 Jan 2008 08:20:53 pm; edited 1 time in total |
|
Back to top |
|
|
JoostinOnline
Active Member

Joined: 22 Aug 2007 Posts: 559
|
Posted: 27 Jan 2008 08:13:30 pm Post subject: |
|
|
I am not sure if I understand what you are saying. If I do, then this is not a challenge. Here is my answer:
Quote: :[[1,1,1,1][1,1,1,1] |
|
Back to top |
|
|
nitacku
Advanced Member

Joined: 23 Aug 2005 Posts: 408
|
Posted: 27 Jan 2008 08:14:48 pm Post subject: |
|
|
I suppose I should clarify that the matrix should be {12,8 |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)

Joined: 25 Nov 2004 Posts: 3976
|
Posted: 27 Jan 2008 08:16:39 pm Post subject: |
|
|
I'm confused.
Quote: {12,8→dim([A]
Fill(1,[A]
[A] |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru

Joined: 23 Apr 2006 Posts: 1477
|
Posted: 27 Jan 2008 08:20:12 pm Post subject: |
|
|
oops. Forgot to mention. You can't use any other Matricies to do your dirty work |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)

Joined: 25 Nov 2004 Posts: 3976
|
Posted: 27 Jan 2008 08:21:30 pm Post subject: |
|
|
Does it still have to be 12×8?
Last edited by Guest on 27 Jan 2008 08:21:39 pm; edited 1 time in total |
|
Back to top |
|
|
nitacku
Advanced Member

Joined: 23 Aug 2005 Posts: 408
|
Posted: 27 Jan 2008 08:23:44 pm Post subject: |
|
|
the solution must be capable of producing a matrix of 12x8 |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)

Joined: 25 Nov 2004 Posts: 3976
|
Posted: 27 Jan 2008 08:33:38 pm Post subject: |
|
|
36 bytes (highlight below):
cumSum(identity(4
Ans+Ans[font="arial"]т-identity(4
augment(Ans,augment(Ans,Ans
augment(Ans[font="arial"]т,Ans[font="arial"]т
(Highlight to here or the last transpose won't show up.)
[EDIT] – Saved 3 bytes.
Last edited by Guest on 27 Jan 2008 08:52:06 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: 27 Jan 2008 08:55:42 pm Post subject: |
|
|
Darn! Just as I get to the 39 bytes, you optimize again.
My solution will get prizes for being ugly, though.
Edit: 26 bytes and as ugly as promised:
0→rand
-int(-fPart(cumSum(abs(πrandM(12,8
You can remove the first line, but then there's a 35% chance it won't work.
Last edited by Guest on 27 Jan 2008 09:01:59 pm; edited 1 time in total |
|
Back to top |
|
|
nitacku
Advanced Member

Joined: 23 Aug 2005 Posts: 408
|
Posted: 27 Jan 2008 09:06:47 pm Post subject: |
|
|
Here's my solution at 32 bytes:
Quote: [[1,1,1
For(X,0,4
augment(Ansт,Ansт
End
|
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)

Joined: 04 Nov 2003 Posts: 8328
|
Posted: 27 Jan 2008 09:11:57 pm Post subject: |
|
|
Optimized to save another byte, down to 25 (yech, this is truly horrible code):
37→rand
-int(-fPart(abs(πrandM(12,8
Last edited by Guest on 27 Jan 2008 09:13:41 pm; edited 1 time in total |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru

Joined: 23 Apr 2006 Posts: 1477
|
Posted: 27 Jan 2008 09:13:32 pm Post subject: |
|
|
I must point out here that so far, nitacku is winning for speed, but Darkerline is winning in size. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)

Joined: 04 Nov 2003 Posts: 8328
|
Posted: 27 Jan 2008 09:14:49 pm Post subject: |
|
|
Yes, my version isn't going to be winning speed contests anytime soon. Isn't just typing out the 12x8 matrix the fastest way, though? |
|
Back to top |
|
|
calc84maniac
Elite

Joined: 22 Jan 2007 Posts: 770
|
Posted: 27 Jan 2008 09:15:53 pm Post subject: |
|
|
Alternate challenge: Make a routine for an any-case scenario.
Inputs: Number of rows in M, Number of columns in N.
I have 50 bytes.
Quote: :"[
:For(X,1,M
:Ans+"[1
:For(Y,2,N
:Ans+",1
:End
:Ans+"]
:End
:expr(Ans
Last edited by Guest on 27 Jan 2008 09:19:01 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: 27 Jan 2008 09:27:17 pm Post subject: |
|
|
Mine works for any case with less than 106 elements, if you replace 12 and 8 by M and N. Still looking for a random seed that will work for more elements.
Edit: 427 is good for 120 elements.
Last edited by Guest on 27 Jan 2008 09:28:59 pm; edited 1 time in total |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)

Joined: 25 Nov 2004 Posts: 3976
|
Posted: 27 Jan 2008 09:27:49 pm Post subject: |
|
|
luby wrote: I must point out here that so far, nitacku is winning for speed, but Darkerline is winning in size. My routine is twice as fast as nitacku's...! Only the display at the end is what makes it appear to be slow.
Last edited by Guest on 27 Jan 2008 09:30:14 pm; edited 1 time in total |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru

Joined: 23 Apr 2006 Posts: 1477
|
Posted: 27 Jan 2008 10:23:55 pm Post subject: |
|
|
yes, his is smaller, but yours is faster. |
|
Back to top |
|
|
|