« first day (2588 days earlier)      last day (2242 days later) » 

7:03 PM
@EriktheOutgolfer just an idea i had.
generally how *-Flak things go
like ill get a ping from Dj saying "I have a pain-flak like idea" and I will read and cry as I die inside a little
 
how long should I wait before posting a fastest code version of codegolf.stackexchange.com/questions/156988/… ?
@DJMcMayhem thanks
to avoid people shouting at me :)
 
@Lembik i wouldn't do it at all imo
it would prolly be marked as a dupe
but ask meta and see what they think
 
@Christopher oh! That would be a shame
I will ask on meta
 
Good idea
 
why would a fastest code be a duplicate?
we determine duplicates by their answers, not the questions
 
7:17 PM
@Lembik well, I'd say sandbox it and we'll see
 
and I'm quite positive that none of those answers are competitive in fastest code
 
@EriktheOutgolfer ok I am asking on meta now.. but I can stop doing that if you think it's the wrong thing to do
 
ngn
@Christopher a fastest-code version of this would be a substantially different challenge, and in my opinion more fun than the original
 
yeah, I think sandbox is a great idea, but I don't think this really needs to be meta-ed
 
0
Q: Is it OK to ask a fastest-code version of a code-golf question?

LembikI often would like to ask mathematical coding questions in pairs. The first is a code-golf question. That is what is the shortest code that computes a given function? The other is at the other extreme and is a fastest-code question. That is what is the fastest code you can write to compute some f...

 
7:19 PM
I think the meta is a good idea
 
@ngn mine too!
I mean mean in my opinion too
 
1
Q: Is it OK to ask a fastest-code version of a code-golf question?

LembikI often would like to ask mathematical coding questions in pairs. The first is a code-golf question. That is what is the shortest code that computes a given function? The other is at the other extreme and is a fastest-code question. That is what is the fastest code you can write to compute some f...

 
that one is a duplicate
 
:)
I can delete it.. but the answer seems clear
that it's OK
 
you can leave it...it'll get closed as a duplicate, and allow for better searchability to find the original
 
7:21 PM
I just want something to point to when people complain
which they always do :)
 
don't remove it
 
ok.. not removed
 
dupes are not a bad thing on meta. it just increases searchability
but you can dupe hammer it
 
but I will pose a fastest-code version tonight
which means in the next few hours currently
 
But take for example two identical challenges, where one is code-golf and one is fastest-code. Competitive code golf answers are likely to be brute force solutions, or written in things like GolfScript, which are notoriously slow....
 
7:23 PM
thank you Martin Ender!
I wonder if he was thinking of me
ah.. I need to come up with interesting and larger test cases for the fastest-code version
hmmm
ok might take me a little longer
 
you know...we've got an unwritten rule somewhere: We say that challenges are language-specific, and that you are really only competing against answers in that same language...
but that's not always true
 
any ideas how to come up with test matrices for this problem?
 
we really only do it that way if the source code is involved in the scoring
 
ngn
@Lembik random
 
@ngn but which random?
also won't they then have to write code that can read in a matrix too?
the second point is the more important one
I am not sure there is any way round that sadly
 
ngn
7:28 PM
@Lembik I'm not sure what you mean, wouldn't they have to anyway? maybe I should wait for the sandbox
 
@ngn The question will have to say I will run their code I think using test matrices
so their code will have to be able to read in any test matrices I come up with
 
ngn
@Lembik yes...
 
oh the sandbox link has gone codegolf.stackexchange.com
 
@Lembik Weird... It's still
 
@Lembik It shouldn't matter which matrices you use, if the code is written to take an n×n matrix.
 
7:31 PM
@J.Sallé right but they still have to all run the same test matrices of growing size
 
As long as you use n×n matrices to test the codes, obviously
 
@DJMcMayhem thanks
 
0
A: Sandbox for Proposed Challenges

LembikThe challenge is to write the fastest code possible for computing the Hafnian of a matrix. The Hafnian of an 2n-by-2n matrix A is defined as: Here S2n represents the set of all permutations of the integers from 1 to 2n, that is [1, 2n]. The wikipedia link talks about adjacency matrices but ...

 
any improvements gratefully received
@Mr.Xcoder are you still about? there is a question about your reference implementation
 
7:47 PM
Hey, I’ll take a look when I have time.
 
@ngn Are you referring to range(1, n*2+1) ?
@Mr.Xcoder cool
 
I suspect it's because mathematicians like 1-based indexes.
 
ngn
@Lembik yes
 
@Mr.Xcoder why do you do range(1, n*2+1) and not range(n*2) ?
@ngn I am asking the author :)
 
ngn
@Lembik btw, my comment should have been addressed to @Mr.Xcoder too, but tab completion didn't work...
 
7:49 PM
aha.. we have the answer :)
thanks @Mr.Xcoder
 
CMC Given the prime factorization of n, return the prime factorization of n + 1.
If you can find a better solution the simple primeFactors . succ . product approach, that would be a major step towards the Collatz conjecture.
 
@recursive I am no mathematician :)
@Lembik The pleasure is on my side
2
 
@Mr.Xcoder Me neither.
 
@ngn do you think my sandboxed question is OK as is?
 
ngn
7:54 PM
@Lembik just a moment, I haven't read it yet, I'm still not sure the ref impl is correct
 
@ngn ah ok!
thanks so much for checking
 
Welcome to the site! This is a nice first answer :) — DJMcMayhem ♦ 4 mins ago
@DJMcMayhem No, it is invalid
 
@Mr.Xcoder a bug? sigma[2*j-1] looks wrong when j = 0
 
@H.PWiz Wow. I even read the challenge earlier today, and I didn't notice that it was restricted source
 
ngn
@Mr.Xcoder you changed: for j in range(1, n+1): prod *= matrix[sigma[2*j-2]-1][sigma[2*j-1]-1] to for j in range(n): prod *= matrix[sigma[2*j-1]][sigma[2*j]] but the j is multiplied by 2, so now it's still off by 1 with the opposite sign
 
7:56 PM
@Lembik: I just posted a comment to that effect.
 
@recursive I was copying you
but making it a little more specific
 
@ngn @recursive @Lembik Please edit in yourseves to address the bug. I have some stuff to do now :)
 
however you slice it we don't want sigma[-1]
fixed now?
 
looks good
 
cool
fixed the sandbox version too
 
ngn
8:00 PM
@Mr.Xcoder sure, sorry for nitpicking on your otherwise working code
@Lembik I must be getting annoying already... Shouldn't matrix[sigma[2*j+1]][sigma[2*j]] actually be matrix[sigma[2*j]][sigma[2*j+1]]?
 
@DJMcMayhem I'm quite surprised as to the number of people who have misread the rules
 
ngn
@Lembik it probably doesn't make a difference because of the symmetry of the (no pun intended) symmetry group
 
csi is the best thing ever. I can use C# as a scripting langage without needing to define a class and Main method, there's a bunch of implicit imports for common functions, and it allows a #! line.
Python, I'm leaving you.
 
ngn
@Pavel java had the "beanshell" long ago :)
 
@ngn That's not the same thing. Beanshell is crap, I've used it before becoming englightened by the .NET way.
It's like if you took Java and gimped the already lacking standard library
csi is actually an official tool that comes with roslyn
 
8:12 PM
@Pavel does it allow you to investigate crime scenes? ⍨
drum roll
 
@ngn Ah, I wasn’t annoyed at all. I didn’t want it to sound that way, sorry. I was just a but busy so I didn’t phrase that too well :)
 
does PDFLaTeX like not support mathbb or something like that ಠ_ಠ
 
How long should I leave my sandbox post until I make it into a challenge?
 
@JungHwanMin there's not a set time, but the usual consensus is at least a week.
 
From 2 days to 1 week, depending on how much feedback you received
 
8:14 PM
alrighty
 
@J.Sallé well, the "official" recommendation is 72 hours
 
@EriktheOutgolfer really? I've never seen a meta post about that, I just said what I was told when I first joined here
 
yeah, I don't follow that recommendation either, I don't think I've ever left a challenge on the sandbox for less than 4-5 days or something
 
ngn
@HyperNeutrino \usepackage{amsfonts}?
 
hm ok i'll try that
 
8:21 PM
@ngn its not annoying it's really great. I am not at my computer for about 12 hours now. Please fix anything that is wrong
 
ngn
@Lembik done (at least the +1 / -1 wrongness)
 
@Adám wow that's complicated, I can tell there's a probability you've had a rough day, and this is the reason why
 
8:37 PM
oh my god amsfonts "wasn't working" because I forgot the s at the end ಠ_ಠ
 
that's one of my most common errors...
in any language
but mostly when getting images from websites... .-. they can never be constant...
 
9:04 PM
What is the Stack Exchange keyboard shortcut for cite? (applicable to places like Math.SE)
 
well, press ? and find out :P
 
not there :P I tried that already
 
then I guess there is no shortcut?
 
apparently not then ¯\_(ツ)_/¯
 
maybe you could ask somebody over their chat room, they might know better than me
 
9:09 PM
@Mr.Xcoder no
 
...a tad late for a CMC, no? :P
 
CMC: Given the Fenwick tree representing the array a of positive integers in its flat representation and and integer n, return the sum of the first n elements in a.
 
VTC as off-topic, multi-part challenge
 
uh no it isn't (?)
 
1) parse Fenwick tree 2) take first n elements 3) sum
 
9:15 PM
Parsing the Fenwick tree is literally just reading in a list
by your definition "add 2 numbers" is multi-part then because you have to:

1. Read the input
2. Convert them to integers
3. Add them
 
"convert them to integers"? no, that's not always necessary
 
ok but my point is that my CMC isn't really multipart :P it's just read a list and then do something with it
 
still multipart
 
What's a Fenwick tree
 
ok fine but there are a lot of challenges that take a list and an index...
 
9:18 PM
@HyperNeutrino test cases please.
 
ok will do
 
@EriktheOutgolfer i relaized that after typing, i'm running at 50% efficiency right now
:/
unfortunately.
 
@Pavel efficient way of representing prefix sums of an array wiki
 
Uh, multi-part challenges aren't off-topic here ... ?
 
@ThomasWard not that I'm at 100% efficiency, currently watching Survivor Greece 2018 :P
 
9:19 PM
@AdmBorkBork lol i hope that's the case
otherwise we'd just be implementing opcodes
 
@EriktheOutgolfer i'm literally at 50% efficiency because Err: Dead Tired
 
oh wow you should literally go to sleep
 
@ThomasWard that's the most common error in a programmer's life now isn't it?
 
get some of that 5 hour energy
;);)
programmers don't need sleep
 
@Poke why sleep when you can coffee
 
9:21 PM
caffeine and vitamins are all you need
 
Chug five 5-hour energy drinks to get 25 continuous hours of energy.
 
while still too young for coffee, I've already decided against it
am I weird?
 
"too young for coffee"
 
lol I forgot doing ^ mentioned the latest message
 
[9, 8, 2, 0, 8], 3 -> 0
[0, 7, 0, 8, 8, 7], 3 -> 8
[7, 7, 7, 4, 0, 3, 0, 4, 4], 2 -> 14
[0, 8, 0, 5, 4, 7], 1 -> 8
[2, 2, 0, 0, 8, 1, 1], 6 -> 2
[7, 4, 6, 1, 2, 9, 0], 3 -> 1
[7, 8, 0, 8, 1, 2, 8, 0, 1, 8], 0 -> 7
[7, 6, 1, 1, 2, 8, 8, 0], 3 -> 1
[3, 4, 0, 7, 3, 5, 9, 4, 6, 6], 2 -> 4
[9, 9, 5, 3, 9, 1, 6, 6, 2], 5 -> 4
 
9:22 PM
CMC: Given a list of integers, add 1 to all positive odd members and subtract 1 from all the negative odd members.
 
@EriktheOutgolfer the efficiency hit and its corresponding error of being dead tired is because of Err: Adaptation to Medication Required for a new med I'm on
 
@EriktheOutgolfer If so, I'll be weird with you. :D
 
@EriktheOutgolfer Say what? I don’t see how that is multipart
 
@Pavel jelly, 4 bytes: ḂaṠ+
 
lol you beat me to it (I had Ḃ×Ṡ+)
 
9:23 PM
PS - 5-hour energy drinks taste nasty
 
I keep off of such drinks
 
Good ol' water.
 
good ol' sleep
 
@AdmBorkBork buddy of mine once said they tasted like horse piss. No idea how he knew what horse piss tasted like, but anyhow...
 
also my instinct says that when you drink coffee you're doing more harm than good, since you are still tired, but just have temporary 5-hour energy or something
 
9:26 PM
I just drink coffee because I really like how it tastes. I honestly don't notice the caffeine affect
 
@HyperNeutrino could you enlighten me as to why the first 3 elements of that array sum to 0 instead of 19?
 
unfortunately it's also the taste that I have, I've tried to sip a little, 'twas godawful, spat it out
 
Supposedly, eventually your body adjusts to the caffeine levels, so that you need coffee just to reach what would have been your normal energy level.
 
I mean drinking coffee in the morning to wake up is sometimes necessary in place of sleep because unfortunately not everyone is able to get up as late as they'd like because work :P
 
isn't there legislation about that? and of course you should manage sleep properly :P (says who?)
 
ngn
9:27 PM
@J.Sallé it's a flattened fenwick tree
 
@EriktheOutgolfer I remember thinking that too lol
 
Oh that's embarrassing, I forgot to convert the random arrays to Fenwick trees :P
[1, 6, 7, 18, 0, 4, 1, 32], 5 -> 22
[1, 8, 4, 13, 3, 8, 6, 27, 4, 4], 8 -> 31
[9, 12, 5, 25, 9, 12, 0, 37, 2], 4 -> 34
[5, 11, 1, 17, 7, 7, 5, 29, 8, 11], 7 -> 29
[6, 12, 8, 25, 6, 11, 1, 42, 6, 9], 5 -> 36
[6, 11, 5, 25, 5, 13], 2 -> 16
[6, 11, 8, 23, 4, 5], 2 -> 19
[9, 18, 5, 28, 0, 2, 2], 4 -> 28
[1, 5, 4, 10, 2, 10, 0], 4 -> 12
[0, 3, 3, 9, 9, 10], 0 -> 0
that should be actually correct ಠ_ಠ :P
anyway brb o/
 
@ngn I've no idea how that sum works. The gif doesn't help >.>
 
ngn
@J.Sallé idk either, i'm reading about it :)
 
@Pavel Appleseed, 47 bytes: (partial map(macro(n)(+(*(sgn n)(mod n 2))n))?)
 
9:34 PM
@DLosc Is partial something that got added recently? I don't recall seing it before.
 
Not terribly recently, let me look...
No, it was there in the original commit.
 
Huh
 
Also, 46 bytes: (partial map(macro(n)(+(*(sgn n)(odd? n))n))?)
 
9:49 PM
@Pavel Proton, no lambdas, 52 bytes: map(((((%)&2),((*)&1,abs+((or)&1))+*(/))+*(*))>>(+))
 
@HyperNeutrino How did you manage to have more parentheses than the Lisp solution
 
Proton, lambda, 30 bytes: a=>[e+(e%2)*(e>0?1:-1)for e:a]
 
Also, is & the partial application operator?
 
@Pavel ¯\_(ツ)_/¯ operator precedence is annoying for function compositions
@Pavel yes
 
@HyperNeutrino Is that Proton's version of point-free?
 
9:52 PM
@cairdcoinheringaahing basically yes :P
 
What would happen if I did map((((%)&2, ... instead?
 
actually that would work
i'm bad
 
ngn
I'm still trying to understand Fenwick trees. Is this the correct algorithm for looking up prefix sums from your examples (code from wikipedia):

#define LSB(i) ((i) & -(i))
sum_t Fen_sum(sum_t const *a, unsigned int i) {
sum_t sum = 0;
while (i) { sum += a[i-1]; i -= LSB(i); }
return sum;
}
 
well it should be while (i > 0)
wait it doesn't make a difference
yeah I think that's right
 
ngn
@HyperNeutrino same thing
@HyperNeutrino so if for example i=4 (that is, n=4), the result should be only the fourth (at index [3]) element?
 
10:07 PM
yeah
 
ngn
that is the case in this example:
[9, 18, 5, 28, 0, 2, 2], 4 -> 28
@HyperNeutrino but not in others with n=4
 
huh that's weird. no idea why, sorry
I'll have to look at my implementation again but busy rn
anyway gtg o/
 
ngn
@HyperNeutrino no prob, thanks to your cmc I feel like I learned something interesting today - Fenwick trees :)
 
Q: How long should a challenge writer wait before declaring winners in a CnR challenge?
ಠ_ಠ SE chat isn't letting me edit that
 
@cairdcoinheringaahing forever
no need to declare winners IMO
 
10:19 PM
@WheatWizard for the badges
> foodback :/
 
@Christopher badges?
 
@WheatWizard ones involving accepted answers
 
@Christopher it's been downvoted, so I'd advise against posting it in its current form
 
@Christopher That's not a really good reason.
 
@EriktheOutgolfer it was downvoted before it's current form
@WheatWizard +15?
 
10:21 PM
@Christopher True, but I don't think 'the current form' addresses every problem raised
 
@DJMcMayhem like what?
i have been trying to find what is wrong :P
 
"Optimization for test cases is not allowed" How do you enforce that? — NieDzejkob Feb 20 at 19:01
5 minutes on which machine...? Yours? Specify that please. — user202729 Feb 21 at 5:49
 
@DJMcMayhem I did address that iirc test cases for the winning will be posted 1-2 weeks after the challenge is posed
 
I missed that
 
the 2nd one idk how to fix
i do want actual functioning answers :P
 
10:24 PM
But somehow, that makes it less clear. winning and score are not the same thing?
 
one sec
 
@Christopher Specify a machine
Simple fix
 
@DJMcMayhem i wanted to say TIO but then you have to use TIO :/
 
Also, TIO limits you to 1 minute, so that would be super hard to test :P
 
yeah
 
10:25 PM
WW had a good point about using integers instead of strings
 
the mod use :P what does this mean
@DJMcMayhem yeah i mean yeah
 
lol mods are users too
 
@Christopher ...oO(The same thing as literally every user means?)
 
@DJMcMayhem crap he is on to me
oh wait
 
@DJMcMayhem Dennis, somebody stole another trademark ;P
 
10:27 PM
did WW mean that you take integer input?
@EriktheOutgolfer * ...oO(flags for plagiarism needed?)*
 
No, he was saying that the output should be an array of ints rather than a string
 
oh
isn't that the same thing?
just without the -A flag
 
No. It allows negatives
 
huh that works
 
And also, because it's the same thing, there's no reason to treat it as strings
 
10:28 PM
yeah
i still would like to take text input though :/
have answers support both?
oohhhh
perhaps that can be a super sick CnR
 
I have no clue what you mean
 
one sec
@mods do you have the stupid message delay?
 
@Christopher So 'support both' means 'do it with ints', but then add a confusing after note about how there might be a flag added which doesn't actually affect what your program does
 
@DJMcMayhem no, support taking text and int input (not at the same time :P)
what about you have ur code. and you give a levithan distance, the robbers have to find the code with that levithan distance that takes text input instead of integer
 
But why? What advantage could that possibly add?
 
10:31 PM
hmm more changes needed
@DJMcMayhem just idea floating in the head
i really want to make a CnR because I mostly work on Code-Golf questions
@DJMcMayhem you think that i could viably make this into a fun CnR?
@DJMcMayhem me and you have sent the same amount of messages this week :P
 
@Christopher No offense, but not really.
 
@DJMcMayhem thanks, makes sense
 
@cairdcoinheringaahing just follow what the original plq did
 
10:51 PM
@totallyhuman Its about 9 days too late for that :P I think a month is a reasonable time to accept a winning cop and robber
 
11:12 PM
0
A: Sandbox for Proposed Challenges

Wheat WizardYour task is to output the exact string The Jabberwocky without taking input. Of course there is a catch, it wouldn't be fun without a catch. Your program, when stripped of non-alphabetic characters must start the poem The Jabberwocky. Here is the text for reference: twasbrilligandtheslith...

 
@cairdcoinheringaahing how will you accept a robber?
 
Anonymous
@totallyhuman Two threads, like usual?
 
nah the winning criterion for robbers is the most answers
so which answer will be accepted?
 
Anyone know how you would find the path of an image (from a lens or something) of a moving particle?
 
high hopes for science in tnb :P
 
11:23 PM
:p
 
Anonymous
@Zacharý At any given position of the object, you can determine the image using the standard lens equations. From there, it's just a matter of integrating the path or interpolating the images at given times.
 
I might have misspoke.
I meant to say given a moving point light source and a fixed mirror, how would one go about finding the areas that are not illuminated at any point in time?
I got my optics words mixed up before
 
11:42 PM
@Zacharý find the path of the light source and reflect it across the normals of the ends of the mirror or something?
 
I think I got it. Parametrize the path. Find formulas for the angle between a point on the path, an endpoint, and the mirror itself. Then find the minimum/maximum (depending on how it's measured) angle across the path using derivatives. Since either larger or smaller angles (depending on measurement) determine the amount of shadow, that should work. (I suck at explaining things)
 
@Zacharý is the mirror flat
 
Yes.
 
@Zacharý Then you don't need a derivative to find min/max angle at all right
just use the angles from the two ends of the mirror
 
Anonymous
11:59 PM
Probably easier to start with a simpler version: consider a moving source that shoots out a single particle every t seconds, moving parallel to the plane of the mirror at velocity v. Compute the locations where the particles end up. Then take the limit as t -> +inf for a continuous stream of particles. Then you can consider stuff like luminosity and alternate paths of the source.
 

« first day (2588 days earlier)      last day (2242 days later) »