« first day (3132 days earlier)      last day (1715 days later) » 

Anonymous
12:28 AM
@Pavel It does if it is declared in the global scope
 
5:35 AM
Is there any way to check where those random +1 reps come from? I assume someone has deleted a post I downvoted, but there's no link to it
 
 
2 hours later…
7:34 AM
0
A: Sandbox for Proposed Challenges

user2190035The goal is to make a program that is compilable in as many languages as possible. The program must be compilable with a specific compiler version and compiler parameters without any errors. The program may result in an error when run.

 
 
1 hour later…
8:43 AM
@DJMcMayhem yes so far I also thought it was rare, I did however observe it twice in the last few days. But I hope this is just an unfortunate coincidence.
@Mr.Xcoder I think every edit/change in state of open/closed bumps a question to the front again, doesn't it?
 
@flawr I think it does bump it on the Active page, but personally, whenever I look for challenges, I browse the "New" page
I don't know about others though
 
 
2 hours later…
11:10 AM
0
A: Sandbox for Proposed Challenges

Darren HSelf-fibonaciing prophecy Where L is the length in bytes of your source code and n=(L+2)^2 Your program or function should output Fib(n) Your program or function should take no input, and output according to the usual code golf rules This seems like a very simple task, but the (L+2)^2 part is...

 
 
1 hour later…
12:28 PM
0
A: Sandbox for Proposed Challenges

flawrCount the number of triangles code-golfarrayintegersgeometry Given a list of positive integers, find the number of triangles we can form such that their side lengths are represented by three distinct entries of the input list. (Inspiration comes from CR.) Details A triangle can be formed i...

0
A: Sandbox for Proposed Challenges

flawrCompare Multiratios EDIT: No doesn't make any sense, I need to think about it again.

 
@JoKing That's where they come from, I don't think there's a way to see which post (since it's deleted now)
@flawr What's the second one?
 
12:49 PM
@DJMcMayhem I can't find it right now, I see if I can find it later.
 
1:27 PM
0
A: Sandbox for Proposed Challenges

A _Up side down keyboard Jono 2906 had tried to create a translator from plain Australian to up-side-down text after inventing a keyboard dedicated to typing up-side-down text. They want to introduce the keyboard to the rest of the world. However, they only wish to type in their own keyboard and wi...

 
2:26 PM
0
A: Sandbox for Proposed Challenges

bigyihsuanN-bonacci from a Seed Tags: code-golfmathfibonacci Given a list of integers L of length l and an integer n, output the first n digits of the l-bonacci sequence starting with the sequence L. Input Input is a list, array, delimited string, stream, etc of integers, and an integer. Input is flexi...

 
3:17 PM
CMC: Given an integer N>0, return a function (or a string of code) that bijectively maps the positive integers to the N-tuples of positive integers.
 
3:30 PM
@DJMcMayhem Dyalog APL, 13 bytes (⊢⍉⍨⍴=⍴)∘⍳2∘⍴ (I think this is what you wanted?)
 
@J.Sallé Not quite. For 2 it should give something like (1 1) (1 2) (2 2) (1 3) (2 3) (3 3) (1 4) (2 4) (3 4) (4 4) (1 5)...
I probably didn't word the challenge super well, is there a better way to state that?
 
ngn
@DJMcMayhem ngn/k: {$[y~*y;2/(0N;x)#1_2\y;2/1,/2\y]}
 
@DJMcMayhem i understood it pretty well (i think). i just don't understand the reason for needing to return a function instead of just taking 2 args
 
Oh, yeah taking two args is probably better
 
ngn
in my case it's the same
applying a dyad to 1 arg curries it
 
3:34 PM
So CMC: Given two positive integers, N and k, return the k'th N-tuple in a bijective mapping of integers to N-tuples
Is that better?
 
that's an interesting problem
 
^ yeah, it feels like main material if it isn't a question already
 
Husk: πN
 
maybe it's just me, but i think the original formulation is more clear
 
!πN for indexing
 
3:38 PM
@primo I agree, but they're different. The original formulation only takes one input technically
 
ngn
@ngn no tio link as i need to (ask Dennis to) update tio. explanation: for a list, encode the numbers in binary, concat, prepend 1, decode from binary. for a scalar do the reverse.
 
I'm writing up a sandbox post. Should the N-tuples contain 0, or just positive integers?
 
I know for 2-tuples you just do the standard square diagonalization but I've been trying to wrap my brain about visualizing that in more than two dimensions and I just can't
 
I can visualize in in 3D, but anything beyond that breaks my head. (Just imagine those diagonals on squares extending out from the corner of a cube)
 
ngn
@Pavel given an n-tuple you could solve it for an (n-1)-tuple and merge with the remaining item using diagonalization
but there are easier ways
 
3:51 PM
I think the recursive solution is fairly clever
might want to throw some memoization at it so it isn't slow as shit
 
@Pavel Is there a standard name for this? I want to link to something like that in my challenge
 
ngn
hm, i've just realized my solution isn't really a bijection
In mathematics, a pairing function is a process to uniquely encode two natural numbers into a single natural number. Any pairing function can be used in set theory to prove that integers and rational numbers have the same cardinality as natural numbers. In theoretical computer science they are used to encode a function defined on a vector of natural numbers f : N k → N {\displaystyle f:\mathbb {N} ^{k}\rightarrow \mathbb {N} }...
"cantor's pairing function"
 
4:13 PM
Posted
 
@DJMcMayhem Link?
 
Ah, so not actually posted yet
 
@DJMcMayhem Stealing the food from New Post Bot's mouth
 
Only because it was requested :P
 
ngn
4:21 PM
@DJMcMayhem i think you should include 0
 
The early bird gets the worm and NSP is not an early bird
 
@ngn or leave it as a choice
 
Late worm doesn't get eaten
 
ngn
@Cowsquack nooo! no ⎕io, please :)
 
@ngn If your program crashes on 0 and has blank stdout, does it still count?
Wait, did you mean include 0 for N or for K
 
4:23 PM
Or both?
 
ngn
@Pavel of course not. if you were testing my earlier solution, it did assume inputs >0 and it was wrong anyway (not a bijection)
 
0
A: Sandbox for Proposed Challenges

DJMcMayhemMap the N-tuples combinatorics math code-golf Today's challenge is to create a bijective mapping between the positive integers and the N-tuples. (To keep the challenge a little bit simpler, we'll only look at N-tuples containing only positive integers) For N == 1, this is pretty straight for...

 
@ngn hey, at least it's not an input
 
@Pavel 0 should not be included for N because you can't map the integers to the 0-tuples (there's only 0)
The question is if 0 should appear in the N-tuples (so like (0, 0), (1, 0)... rather than (1, 1), (2, 1)...)
 
ngn
it's easier to think of this problem as merging of bit sequences
 
4:26 PM
Yeah that thought occurred to me after I posted
 
I couldn't care less if 0 is acceptable for k or not. That's usually something that's left up to each answer (though I'll state that explicitly)
 
ngn
if 0 isn't allowed, that introduces a special case
 
Throw a curveball, no 0 but -1 must be handled
 
@ngn unless the language at question prefers using ⎕IO=1 enough
 
I wonder, if this challenge allowed for surjective mapping instead of bijective, would that actually allow for shorter solutions
 
ngn
4:28 PM
@dzaima ⊥ and ⊤ still act sanely, even with ⎕io←1
 
@ngn but what if they didn't? e.g. SOGL has a built-in for (a-1)%b + 1 (it also has a regular modulo but that's beside the point)
a major cause for me to go into ⎕IO←0 is because | is "0-indexed" always
 
ngn
@dzaima shrug... what some hypothetical language decides that trits and the crazy operator are fundamental. should we pay any attention to it?
 
@ngn ⎕IO←1 is relatively popular though
 
ngn
@dzaima not in programming
 
@ngn yes in programming
obviously not used nearly as often as ⎕IO←0 but still not non-existent
 
4:36 PM
Hi, is there anybody here who can help me a bit on mathematica ?
 
@Lelouch Sure
We won't know if we can answer your question without knowing the question
 
@DJMcMayhem imo having the input be forced 0-indexed would make more sense than the output, but both (independently) should be choosable by the answer
 
@Pavel This is EXTREMELY BASIC stuff: Basically suppose we need to assign F[a] = a_1, F[b] = a_2, F[c] = a_3. Suppose we have a list of sets with size three L, and for each {i,j,k} in L, we need to define F[a] = i, F[b] = j, F[c] = k and then run IsTrue[F]. What should I write to loop through the elements of L ?
Also do you recommend some short source to have some working knowledge of very basic matheamtica stuff ?
 
I'm not sure I understand. Where are a, b, and c coming from?
 
sorry nevermind I figured out how to do it. Anyway do you recommend any short books for having some working knowledge of mathematica for doing math stuff ?
 
4:45 PM
 
``short books"
 
Nope, m.se is how I learned it
 
5:04 PM
Is there anything wrong with this code:
Do[Homomorph[G] G[a] :=
v[[1]] G[b] := v[[2]] CheckHomo[G, {a, b}], {v, L}]
Where L is the all permutations of {a,b}
 
5:16 PM
@MilkyWay90 So far you're only really rehashing the other links in your doc like the esolangs page. Is your tutorial supposed to be comprehensive or is it solely "to prevent other people interested in Malbolge falling into the obstacles I have fallen in" in which case I'd expect this tutorial to require a base of understanding for the language
other than that it seems like a good draft
 
 
1 hour later…
6:24 PM
I just got a badge for a question with >1k views that I asked yesterday on BG.SE, which is definitely not the most visited site here (most questions have ~200 views). Thanks HNQ.
 
@J.Sallé BG?
Does anyone have any last words on this challenge?
 
@flawr Board & Card Games
 
@flawr in nomine Patris et Filii et Spiritus Sancti
2
 
@AdmBorkBork XD
 
How does [1, 1, 1] equal 1?
 
6:30 PM
@AdmBorkBork there is exactly one triangle
 
That doesn't satisfy a+b>c
 
a=1, b=1, c=1?
 
1 + 1 > 1
the math checks out
 
Oh, dur, I was reading it <
 
@AdmBorkBork actually I wrote it as < in the very first version :D
 
Rod
6:32 PM
@flawr what's the point of the oeis link in the bottom?
 
Do a and b have to come before c in the list? Else why does 42+69>1 not work?
 
@Rod not that relevant, but we do like OEIS quite a lot here:)
@AdmBorkBork nope, every permutation of a,b,c must satisfy the triangle inequality, should I clarify that?
 
@AdmBorkBork 1 + 42 < 69.
Wait, brain fart. Double brain fart!
 
@flawr Ohhhhh. Not that there is some a,b,c such that a+b>c, but also that a+c>b and b+c>a?
 
@AdmBorkBork right
 
6:36 PM
Got it now
Maybe highlight a triangle can be formed if *all permutations* ...
Or else spell out the other two inequalities and say it must satisfy all three.
 
@El'endiaStarman peditum cerebri repetitum
 
@flawr All hail the Sloane
 
ngn
i wonder, if there's the triangle inequality, there must be a tetrahedron inequality too? that would make a spicier challenge :)
 
@ngn hmmm
that actuallly could make sense:
you'd have to use the areas:
the area of any three sides must be greater than the area of the remaining side
interesting!
 
ngn
@flawr either the 4 areas of the faces or the 6 lengths of the edges
 
6:39 PM
It's 4 applications of the triangle inequality.
 
@AdmBorkBork yeah that is probably the best, solution, thanks!
 
ngn
@El'endiaStarman but not all sets of 4 valid triangles make a valid tetrahedron
 
Oh, lol, I could've just looked at the second line of your Haskell TIO to see the inequalities.
 
@ngn Of course not.
Given six edges a b c d e f, then [a b c], [a d e], [b e f], [c f d] must all satisfy the triangle inequality.
 
ngn
@El'endiaStarman necessary but not sufficient
 
6:44 PM
@ngn Oh, you have a counter example?
 
ngn
@El'endiaStarman 9 9 9 5 5 5
 
Oooooh, you're right.
I see why applying the inequality to areas can work.
It's probably sufficient that the sum of three areas is greater than the fourth and all faces satisfy the triangle inequality.
 
ngn
@El'endiaStarman sounds right
 
well I posted it now, but I think the title is not very creative
I should have thought about this before
 
6:59 PM
0
Q: Count the number of triangles

flawrGiven a list of positive integers, find the number of triangles we can form such that their side lengths are represented by three distinct entries of the input list. (Inspiration comes from CR.) Details A triangle can be formed if all permutations of the three side lengths \$a,b,c\$ satisfy ...

 
+1 for the title
 
any suggestions?
@J.Sallé "Count the number of quadrilaterals"?
 
Hahahahah it was a joke, I have no suggestions because I'm not creative >.>
Also, I think triangles are not quadrilaterals?
 
yep
so I'd probably get a lot of comments, but not more answers:)
 
They are degenerate quadrilaterals
 
ngn
7:06 PM
@J.Sallé well, you did say "+1" :)
 
@ngn nailed it
 
I mean if anyone has a suggestion regarding my title let me know!
 
7:18 PM
can we do better than n(log n) when decoding this back to the original array?
https://tio.run/##TZDNbsMgEITvPMUcQXad/p4c90UsHwje2DgUIiCtqirP7i5ClXoAMTPfrFZs@lMnE@01P/gw0747ytAxYsD41L62L@1z@zb1otjkDSMlYUOcQ5TFtWw89rDHUusc@SWvLJtG/QgUIN0@KiKAv9I2sN6Olq8KAvYsecBoJ7yXSeM2KW42Q30XQuDOR9Q1uustrZIJ1ZcE4i5ggk/BUefCIiulxOEAoz2@CHPAiXKmiLyy4yVj8ArWYyaGrV84sQknbS7IgQUhxMV67cpG@vv/l4h9/wU
 
Huh... interesting function
 
yeah, it is.
 
Are you sure it's injective?
 
it's not one to one, it is also one too many based on an index, I think
 
then by decoding, do you mean finding any preimage?
Also, do you have an example of a collision?
 
7:26 PM
also, you are guaranteed the values are always 1->n where n is the length of the array. Just that array that's there just decode it back to [1,4,3,2,5]
actually, I take that back, it will always be one to one.
 
@J.Sallé a triangle is half a quadrilateral
 
@EriktheOutgolfer in some cases a pentagon is also half a quadrilateral
sometimes it could even be a hexagon:)
 
umm... example? pretty sure that if you cut a quadrilateral you'll never get two pentagons :D
 
That's not what flawr said. :)
You can cut a quadrilateral such that one piece is a pentagon.
 
and the other will be a triangle :P
 
7:36 PM
Regardless, a pentagon has been shown to be half of a quadrilateral.
 
@JohnDvorak the only solution I can think of is a depth-first search that checks against every value until every node is touched and the length is 0.
but that's brute force, I think.
 
@El'endiaStarman er... by "half", I mean that the other half is also of the same kind (not necessarily equal), which is only true for triangles ;)
specifically, for triangles that share at least one side length
 
23
Q: Bijective function ℤ → ℤⁿ

Esolanging FruitIt is trivially possible to create a bijective function from \$\mathbb{Z}\$ (the set of all integers) to \$\mathbb{Z}\$ (e.g. the identity function). It is also possible to create a bijective function from \$\mathbb{Z}\$ to \$\mathbb{Z}^2\$ (the set of all pairs of 2 integers; the cartesian prod...

My sandbox post from earlier is a dupe
 
@Rick so, what's the motivation?
 
@JohnDvorak understanding why this encoding more difficult to decode than encode
 
7:44 PM
Any old hash function is hard to invert, and if you can't even guarantee one-on-one, your function is as good as any old hash ;)
 
I would have to search a huge chunk of the permutation space before I even get an answer
I think it is guaranteed to be one-one-one.
 
Anyone up for a game of Contact?
 
the values in the array will always be a consecutive sequence starting from 1
and the array will never contain a value outside the range of its length
so if the array is length 2. you know it will contain 1 and 2 etc..
 
@DJMcMayhem Bummer. Glad it was found early, though.
 
8:07 PM
@cairdcoinheringaahing Thanks for sharing, joining!
 
8:58 PM
0
A: Sandbox for Proposed Challenges

Mr RedstonerJava vs C++ Note: I haven't invented this task, but haven't found it here and it seems fun. Feel free to tell me if it was done before. I'm changing it up slightly to try and fit the site more. Story In an unnamed company, some people use Java and some use C++. This was always a nuisance, and ...

 
 
2 hours later…
10:57 PM
My first computer science lab is tomorrow, I am so ready to flex on all the noobs
 
11:34 PM
@Poke It's just supposed to be easier to understand for novice programmers like I
 

« first day (3132 days earlier)      last day (1715 days later) »