« first day (2373 days earlier)      last day (2485 days later) » 

12:20 PM
Do you know of any languages (golfing languages) that have check-if-a-number is triangular built-in?
 
I have no golfing language knowledge, but you've come to the right place...
 
@trichoplax Do you know Python?
 
I do.
 
Ok, I wonder how you'd do it in Python
 
12:26 PM
I solved it (in the past) by checking if 8k+1 is a perfect square
 
That's the way that answer did too - which is currently the shortest Python approach
 
Yep, that's the way I solved it too. Thanks for the reference @trichoplax
 
Anonymous
The exact method the answer used isn't ideal though, because large values will overflow
 
@Mr.Xcoder You're welcome. I just searched for triangular is:q
 
Anonymous
But it's the golfiest if large values don't need to be handled
 
12:28 PM
I am not looking for efficiency. I was looking for golfed code, of course 8*(large_number) overflows :p
 
Anonymous
@Mr.Xcoder That's not the part that overflows. (large_number)**.5 does, because floats have limited range (ints don't in Python).
 
> You may assume that the input is a positive integer under 10^6
 
@trichoplax I answered that question, and couldn't remember >_<
 
Anonymous
A slower and less-golfy solution that avoids overflows would be lambda n:any(x**2==8*n+1for x in range(n+3))
 
It seems that answer doesn't cover the full range of values required by the spec then
 
12:30 PM
@Mego Oh yeah, you're right, I don't know why I thought about Int overflow in Swift
@Mego Nice one.
 
I misread - it fails for 1<<10000, not for 10000, so the answer is fine for the range defined in the question
 
Do you think Jelly would be able to solve #PE 8?
 
@Mr.Xcoder If it can handle 64 bit integers, yes. Otherwise, probably
 
I switched to Python just in case
 
Can you solve it including vertically adjacent too?
I don't know any Jelly so I can't guess anything
 
12:38 PM
Wait, numbers do not have multiple lines don't they?
 
the biggest number you can possibly achieve is 9**13, which can be expressed in only 42 bits, so I think you should be fine with Jelly
also Jelly runs on Python, so there shouldn't be any difference in handling large numbers
 
@Mr.Xcoder No, so it would only work in that particular layout, not if you write the number in an arbitrary number of lines or on one line
 
Yeah, but I am not that good at Jelly yet, and my memory is quite low
@trichoplax I don't know. Maybe in Python as a few-hours project, IDK
 
@Mr.Xcoder You definitely won't run out of memory even if you store all (1000-13) less than 42 bit numbers.
 
@trichoplax Not if I multiply each integer formed by each contiguous substring :D
 
12:41 PM
@Mr.Xcoder I can't account for approaches like that :P
Have you solved it for 4 digits, to check you get the same answer as shown in the question?
 
@trichoplax Nope
 
it was from PE#8 that I switched to APL from Processing due to its power in handling matrices
 
If it takes more than a few minutes to solve, you may be working on a different problem than stated
 
Lool, look at Dennis' rep graph
@trichoplax I didn't start yet :)
 
Oh right
 
12:45 PM
Solved
Submitted. I think PE is pretty cool, I'll start solving the things there
 
That should return pretty much instantly for length 13 too
 
I know. It seems very efficient
 
@Mr.Xcoder Yes, in 9 bytes:
 
@Mr.Xcoder I get the same answer as your code for length 13 too
 
Nice +1
 
12:55 PM
:)
 
I moved on to #9
 
Oh I guess the +1 is for @LeakyNun :)
 
@trichoplax It's for both, in fact
PE 9 is much more interesting when solved by hand, mathematically
If it is possible (haven't tried yet)
 
A few of them benefit from working out the maths first, otherwise they take a long time to run
 
I am halfway through the maths of PE #9 now
 
1:00 PM
@trichoplax 1000 is actually quite small, so not much optimization is needed
 
The maths didn't quite help a lot (or maybe it will): I have 1000c+ab=500000
Oh, it does
 
@LeakyNun Yes brute force is fine for that one
 
Is it possible to solve such an equation: 1000(a^2+b^2)+abc=500000 knowing that a^2+b^2=c^2, a+b+c=1000, when I want to get abc?
 
@Mr.Xcoder it is possible to brute-force it
knowing that a,b,c are non-negative
 
How?
Programmatically, of course, but...
Oh duh...
 
1:07 PM
16 messages moved to Trash
 
PE #10 is incredibly simple in Jelly, I think
 
did you solve PE#9 completely mathematically?
 
Nope, I was too lazy to do it by hand.
I am surprised it was that trivial 1æR2000000S
 
@Mr.Xcoder it can be shorter
 
Of course it can
Really, 2000000 is ungolfy
⁵*6×2 is there a shorter way to generate 2000000?
 
1:15 PM
@Mr.Xcoder yes
also, there's a monadic prime range
 
@LeakyNun Good to know, thanks
ÆR I suppose
 
right
 
Don't hint
Of course, times2 is double!
 
@Mr.Xcoder it can still be shorter
 
Trying to golf, again
@LeakyNun I'd like to have a hint now
 
1:23 PM
@Mr.Xcoder there's a page you never looked at
 
Quicks?
 
no
 
Tutorial
?
 
no
 
Syntax?
 
1:27 PM
yes
 
I suppose it's ȷ
 
3
Q: Square a Number my Way

GryphonPeople keep telling me that the square of a number is the number multiplied by itself. This is obviously false. The correct way to square a number is to make it into a square, by stacking it on top of itself a number of times equal to its length, and then reading all the numbers from the result...

 
@Mr.Xcoder yes
 
@LeakyNun Thanks a lot for teaching me something new!
 
no problem
 
2:11 PM
an interesting problem, for a given size of n, how many pairs of multisets of positive integers are there such that sum(a) = prod(b) and sum(b) = prod(a)
for n = 2 we have two solutions
1*5 = 2+3 and 1+5 = 2*3
2+2 = 2*2 and 2*2 = 2+2
 
Interesting
 
2:23 PM
Is there any equivalent n Pyth for float() ???
 
no but you can use c for float division
 
@EriktheOutgolfer Is there any way to cast string to float?
 
@Mr.Xcoder XY problem
what do you need a float for
 
@Mr.Xcoder v is eval(A)
 
@orlp The new challenge on main. I have a workaround though
@EriktheOutgolfer Thanks
@EriktheOutgolfer Do you know of any short way to get the digits in a String?
 
2:29 PM
you want to do the square challenge right?
 
Ohh, NVM
@EriktheOutgolfer I don't need that anymore
@EriktheOutgolfer Can you help me golf my solution?
I have this: K--Q\.\-+smv*lK@KdUlK*lKvQ (way too long)
I don't need the Q at the end, -1 byte
I think I should use .e instead of m
22 bytes: K--Q\.\-+s.ev*lKbK*lKv
@LeakyNun Can you help me golf the above ^
I have some ideas about K--Q\.\-
 
@Mr.Xcoder I have 18 bytes
 
@EriktheOutgolfer Hints?
I am getting closer, 4 bytes away now
 
@muddyfish btw jumping in QFTASM has changed now
 
@Mr.Xcoder what's your code now?
 
2:42 PM
@EriktheOutgolfer 22 bytes: K--Q\.\-+s.ev*lKbK*lKv
 
oh I thought you meant you golfed to 18 too
 
Do you take input as a float instead?
 
Ok. Hints?
(If you want to give any)
 
it seems my approach is entirely different
 
2:45 PM
Oh. Then we shall both post :D
 
yeah the algorithm is different so can't really give tips
 
@EriktheOutgolfer Any thoughts about --Q\.\-?
 
@jkUTQ would be better
 
@EriktheOutgolfer Thanks
I'll post mine, you should post yours
 
(I use that in my solution too btw)
 
2:47 PM
Mar 3 '15 at 18:20, by trichoplax
You mean you've just eliminated the 19th byte?
 
@Mr.Xcoder posted
and then you posted
 
@EriktheOutgolfer Posted. Nice approach
Ok, I have to go now.
 
bye
btw it seems nobody has tried my skip like a rabbit challenge in jelly...
 
@trichoplax Why was 19 picked?
 
43
A: Let's think of a creative name for our chatroom

dmckeeWell, the traditional generic name for the country club bar is "the nineteenth hole", which suggests The Nineteenth Byte or something like that.

 
2:55 PM
Thanks.
 
because it's prime and each of its digits are square numbers okay that was silly
 
Also, how many bytes in The Nineteenth Byte?
 
hint: it's right in front of you
 
TIL you can make an in-page link to the "Post your answer" button from the top of a challenge spec.
Although the link you need is different depending on whether the person clicking it already has 1 answer
 
@trichoplax no reason to do that?
 
3:06 PM
Not essential, just one of a few handy links I wanted at the top of a very long spec
For returning visitors who have already read the spec
 
well you can post a comment and link to that...
 
Did not know that.
 
like, under the question, post a comment like this
> You're at the bottom of this post; go get back to the top click [here]
and you include a link back to the top too
 
I'm putting the links as the very first thing in the question, on a single line like this:
Watch live | Active answers | Add 1st answer | Add extra answer | Chat room | Source code
I wanted just one link to "Add an answer" but I had to separate it because the id of the button changes once you've added one answer
 
"active answers" means "go to the bottom and sort as active" right?
 
3:19 PM
Yes - goes to the top of the answer list (bottom of the spec) and changes sort to active.
The link names were all a bit longer but I had to golf them down to fit on one line. Hopefully they are still clear enough
 
btw now you can use 65536 chars instead of 30000
or you're nearing that limit too?
 
@EriktheOutgolfer Coincidentally, the question I'm editing is the very reason I requested 65536 chars, but I didn't end up using them because it's still 30000 on meta so I couldn't test it before posting, so I went with a different approach
I only had to golf because I didn't want the list of links to spill over onto 2 lines
 
@trichoplax I don't think that's something you can control yourself
especially since there are different resolutions and zooms
 
@EriktheOutgolfer As long as it's on one line with a bit of extra space under the standard viewing conditions, I'm happy. I accept I can't cover everything
 
i made a Emoji{,code} polyglot :P
 
3:31 PM
@EriktheOutgolfer There is a fixed maximum width that the box will be.
According to SO's analysis, most people have a window size that puts a border at the sides of the page. (Remember the ad sidebar thing?)
Therefore it is a good idea to tailor to those standard viewing conditions, and doing so means that you cover almost everything.
 
Feels good when you see an answer in your language by someone you didn't even know was learning it. Makes me think my docs aren't actually completely awful
 
3
A: What are the palindromes of my palindrome?

DanTheManBrachylog, 6 bytes {p.↔}ᵘ Try it online! Explanation {p.↔}ᵘ { }ᵘ find all unique... p permutations of the input... .↔ that are palindromes (i.e. equal to itself reversed)

This?
 
you mean dantheman's answer over the palindrome challenge right?
ah ninja''d
@Fatalize too bad his first answer got deleted
 
:(
 
I've tried learning it a few times but couldn't really work it out
Even though I've used Prolog
 
3:45 PM
@BusinessCat classic
just try and you'll learn it
 
4:38 PM
@Fatalize Do you want me to move your existing branchylog discussion there?
 
@wizzwizz4 That would clear out TNB a bit, so yes please
 
54 messages moved to Brachylog
Huh. I've been spelling it wrong.
 
You're not the first :p
== English == === Etymology === Borrowing from Ancient Greek βραχύς (brakhús, “short”) === Prefix === brachy- short ==== Derived terms ==== ==== Translations... ====
 
4:54 PM
Just found this gem on HNQ: unix.stackexchange.com/a/382543/216467
9
 
Bourne's cat isn't mentioned much. It's still too upsetting for everyone concerned. Brian Kernighan's pet awk ate him. — cas 5 hours ago
 
@Christopher SE will give your bounty to a random answer in 3 hours
 
5:16 PM
It looks like your message has been read.
 
19
Q: Does HTTP redirect to HTTPS automatically?

kstWhen we enter an URL in a browser, it uses HTTP by default but if the server only support HTTPS, does the traffic redirect to https automatically without the user noticing? Am I right? If wrong, please correct me.

 
right so using http by default would be more useful that using https
anybody know nim?
 
5:49 PM
0
A: Sandbox for Proposed Challenges

sergiolThe nice angles trig-based function Everybody knows what are the degrees nice angles we can see on the trigonometric circle. The task is you have to write a function which generates the second column outputs based on the inputs of the first column: But rules need to be followed: No complex...

 
6:02 PM
Quesiton: is it better to store a user's followers or who they are following. It seem better semantically to put following also significantly simplifies deletion but then to find followers that is much more difficult because now I have to look through whole DB again
 
hello
 
@Downgoat I suggest both. It's better to update two values every time someone follows someone than have to look through the whole database each time you want to get the values in the direction you didn't store.
 
what is the syntax to put a tag in the body?
 
[tag:tag-name]
 
6:04 PM
@HyperNeutrino not really as unless I get a database that guaranteed synchronization in a concurrent environment having a dependency on two sync'd fields.
though that is good idea for redis
 
@totallyhuman: tks
done.
 
I can generate list of followers/following in redis so not redoing 10000 times
 
It really depends a lot on your needs. I think most large social media sites store it in both directions but I'm not sure.
 
0
A: Sandbox for Proposed Challenges

sergiolThe nice angles trig-based function code-golf Everybody knows what are the degrees nice angles we can see on the trigonometric circle. The task is: You have to write a function which generates the second column outputs based on the inputs of the first column: But rules need to be followed: ...

 
> No programmatic functions; only mathematical functions
???
 
6:07 PM
yeah no control structures
 
What is a control structure?
 
@HyperNeutrino big social media site like facebook made their own DB which are designed to support complex social graphs
 
Ah okay.
 
ino if, else, for , loop, whiles
 
I don't think that's a reasonable restriction, IMO.
 
6:09 PM
^ it's a do X without Y which aren't exactly good
 
is it for gitgoat?
 
i don't wanna git a goat thank you
 
@sergiol also you haven't described the sequence in your question and the entire examples are on the image. You should 1) not describe challenge solely in terms of I/O unless which it seems like this challenge is 2) if you really want to continue as so, it would help to ascii-art the graph in a more friendly format.
@totallyhuman :( what if it's free
 
@WheatWizard your arguments against pop-cons are really good. I keep on thinking about both sides, and I can understand both sides. I can't decide which one I like better
 
@Downgoat: The sequance is what you see on the trig circle
the nice angles 0 30 45 60 90
and so on
may I should add the ?
 
6:16 PM
@Downgoat read: free food :P
 
@Cowsquack says @BigmacsQuack
oops I think I read that wrong >:P
 
@Downgoat for a moment I was wondering how the @-ping pinged me :P
 
Changed my challenge a little bit
 
@sergiol ok so if you are doing 'nice angles' then it's a challenge also is like 59.999999999 ok for 60 because many language will have minor imprecision
@sergiol is functional .map considered a control structure, JS lang does not officially consider it a control structure but it can be considered one.
what about recursion since I can use that to simulate control structure
 
no recursion
as you need to have a control structure to stop it from infinitely deep recursion
 
6:29 PM
also in eval("for(a;b;c)d;") there is technically no control structure in code but doesn't seem like you'd want to be valid
@sergiol so short-circut && is consider control-structure too
 
the real challenge here is to make it the way I spec'ed it
trig-based, no complex, no lists, no control structs
 
@wizzwizz4 I just saw sizeof in the code block above and thought that's what it was doing.
 
@NathanMerrill Thanks. I find it pretty easy myself because of a general distain for the format, but I think this is the question for the community right now. I have my opinions but I can see how this is a difficult thing for the community to decide on.
 
@sergiol so only trig + arithmetic functions allowed in code, nothing else?
 
6:45 PM
no logical nor bitwise operators admitted
I've just added just this restriction also
If I say more, i am telling the solution
which is not my goal
how can I improve my question departing from the current state, please?
 
Must be trigonometric functions based how/why are you going to enforce that?
 
That is to make it more challenging
 
Can any body tell me how to create a 2 dimensional array in python? I saw a few questions already asked on stack overflow but I couldnt get a few help.
 
and also make it based on the trigonometric circle
@AnimeshAshish: off-topic
 
Please guide me, I really need this.
 
6:53 PM
go to freenode's irc python channel and ask there, maybe?
 
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
It's just a list of lists.
@AnimeshAshish
 
7:11 PM
0
A: Sandbox for Proposed Challenges

ugorenProposed Question Triskaidekaphobic Primes It is known that a certain number, which lies between 12 and 14, brings bad luck. The Church of Triskaidekaphobia (CoTDP) asserts that the key to salvation is avoiding this number in all situations, such as numbering floors, license plates, space shutt...

 
There's no such thing as a 2D array.
 
@JohnDvorak In Python or at all?
 
At all
J has various-rank tensors, but they're still just arrays of same-size arrays
 
@JohnDvorak so C# multidimensional arrays are just arrays of arrays with constraints?
 
What are those constraints?
 
7:17 PM
@JohnDvorak same-length
Reason I'm asking:
6
A: What is the definition of a "true" multidimensional array and what languages support them?

Dylan SmithC# supports both true multi-dimensional arrays, and "jagged" arrays (array of arrays) which can be a replacement. // jagged array string[][] jagged = new string[12][7]; // multidimensional array string[,] multi = new string[12,7]; Jagged arrays are generally considered better since they can ...

 
Then yes. The length is just a part of the type.
oh. Isn't that just a syntax sugar?
Can you slice a multidimensional array in c#?
 
@JohnDvorak I don't know C#, I'm just curious, you'd have to ask someone who uses it
 
In any case, semantically it's just an array of arrays with restrictions
 
7:35 PM
@HyperNeutrino you busy?
 
Not really. I'm working a bit on Ceres and I'm in JHT but I'm not too busy
 
is Ceres an esolang?
 
@HyperNeutrino you wanna look at this real quick? Don't try to break it, but otherwise tell me how you think it works (I finished the JS)
 
Yay nice :) It seems to work pretty nicely
 
7:40 PM
@HyperNeutrino For some reason it's borked on mobile, both arrows show up, but I don't really care it works otherwise
 
hm ok :P
Also apparently Google wants to translate JS code from Danish ಠ_ಠ
 
@HyperNeutrino xD
 
3
Q: Continuing the discussion about the friendly challenge

HyperNeutrinoI'm here from PPCG addressing the competition to which Christopher from PPCG challenged you, CR, yesterday. Some concern was voiced by a few trusted users of this community, and I'd like to continue the discussion more specifically based on what they're saying. I understand that incidents in th...

 
1
Q: Weakened Binary Walls

HyperNeutrinoInspired by Create a binary wall Given a list of positive integers, we can write them out all above each other like so, for [2, 6, 9, 4] as an example: 0010 0110 1001 0100 We can imagine this as a wall: ..#. .##. #..# .#.. However, this is a very weak wall, and it has collapsed! Each 1 (#)...

 
Question: What's the difference between /dev/sda and /dev/sda1?
 
7:49 PM
@HyperNeutrino I would sooooo much like a PPCG vs CR koth
 
It sounds fun, but I'm concerned about whether or not it will be a good idea.
 
@Cowsquack thing about KoTH is that code needs to work :P
@HyperNeutrino I think you need to find some way to make PPCG people write clean code and CR people write golfed code, and that be the "competition"
 
which code are you referring to?
 
@Cowsquack PPCG is golfed code, CR is clean code, KoTH is working code
 
@StepHen Hm. That's an interesting idea. However, "clean code" is very subjective and fun fact: we require objective winning criteria over here xD
 
7:51 PM
We have popcons
 
@StepHen exactly, so there shouldn't be a large advantage towards ppcg
 
@Phoenix shush
 
I'm imagining a CR popcon to write the cleanest code to achieve a task.
7
 
I have a really good idea: use @DestructibleLemon 's survival KoTH for this
OK, I have ~115 operators I can implement, what are common operators besides bitwise, +, -, *, /, //, **, and concatenation?
 
zip, fill
reverse
rotate
 
7:54 PM
@HyperNeutrino how many of those work with numerics/strings?
 
fill, reverse, rotate all work with strings
 
(I don't have iterators/similar really)
 
strings are iterators!11!!
(well actually iterables)
anyway brb
 
@HyperNeutrino sorry, I don't really have strings either, it's the str() of a numeric :P
 
@StepHen % => take the square root of each element of an array and perform cumulative addition, then fill it into a matrix while randomising the elements, after which each row is reduced by LCM into an array, and consecutive elements get bitwise XOR performed to each other, and then you do mixed base conversion of the resulting array with itself
 
7:58 PM
@Cowsquack Don't have arrays
 
@StepHen Which bitwise operators do you have? There are quite a few of them.
 
@Phoenix ~, ^, |, &, <<, >>
@HyperNeutrino and I think I'd implement those all as functions not operators
 
so this is a non-esoteric language?
 
Given you have 115 operators, you could make bitwise NAND, NOR, XNOR
 
@Phoenix I'll do that, thanks
 
8:06 PM
@StepHen unary operators for square and square root, maybe?
Along with generic root operator.
 
@Phoenix I could do that, hm. Although it'd be just as long as root/square root since my operators I have are two bytes. Are there any really obscure, occasionally useful operators that don't make sense as functions (like bitwise)
(that is, until I open up to unicode and start doing SBCS)
 
@Phoenix that's what I'm looking for, thanks :)
 
Basically every concievable operator
 
0
Q: Determine max speed horse can run without passing or slowing

csga5000Background: There was a google code challenge or something like that a coworker and I wrote a while back. I can't find it anymore but it was kind of fun. I couldn't find it with a search on this site so I thought it'd be fun to bring it here. Story There is a woman, named Sarah, whom likes s...

 
8:35 PM
1
Q: Check if URL is valid (non-IDN)

TeslaX93https://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax tl;dr: Must begin with http:// or https:// Should detect subdomains Characters a-z, digits 0-9 Cannot start nor end with a hyphen (-) Cannot have a hyphen in third and fourth position, unless the first two characters are 'xn' ...

 
So, when I'm doing string functions (reverse, rotate, etc.) on numbers, should I ignore - and .? Is there ever a time when you wouldn't want . especially to be ignored? Should I include that as an option?
 
8:52 PM
That should probably be an option.
 
 
1 hour later…
10:20 PM
@HyperNeutrino OK I think I made a mess but I got a bunch of stuff done so I dunno if that's good or not
 
10:40 PM
0
Q: Celling the Prime

w1n5t0nYou are given a grid of size n x n filled with numbers in each of its cells. Now you need to count total cells in the grid such that the sum of the numbers on its top , left , right and bottom cells is a prime number. In case there is no cell in a particular direction assume the number to be as 0...

 

« first day (2373 days earlier)      last day (2485 days later) »