« first day (1725 days earlier)      last day (3120 days later) » 

4:01 AM
@Dennis @MartinBüttner My first idea worked. 10,000 instructions now finish in less than a second in the online interpreter (compared to 18), and the Java interpreter handles 100,000 instructions in 0.6 seconds (compared to 28).
 
@Dennis @MartinBüttner Dennis' first idea worked. 10,000 instructions now finish in less than a second in the online interpreter (compared to 18), and the Java interpreter handles 100,000 instructions in 0.6 seconds (compared to 28)
 
ಠ_ಠ
Also, welcome back!
 
Thanks!
Welcome back from what?
 
Anonymous
Back to the USSR, apparently
 
Back in the US, back in the US, back in the USSR.
 
4:05 AM
Not sure, but The 19th Byte was a bird-free zone for some time.
 
Saturday and Sunday. I was on earlier today for a couple hours, then away, now back. And that's the complete history of birds.
 
chirp
 
@Mego The USSR dissolved about 10 years before Putin held any Russian office.
 
Anonymous
b-b-b-b-bird bird bird bird bird is the word
 
Anonymous
@AlexA. I was making a dumb reference, like 90% of what I say in here
 
4:10 AM
About 80% of my time in here is spent trolling so I'm with you on that.
First Google Images search result for "dennis bird."
 
I was just about ask who that was...
 
You mean that isn't you?
 
I couldn't grow a mustache like that even if I tried.
(And I don't.)
 
Anonymous
 
Anonymous
There we go
 
4:14 AM
That's Larry Bird
 
Boy, Fedora and I are having fun lately...
 
mac mac mac mac mac mac
What's that? Do you hear that?
mac mac mac mac MAC MAC
I think it's getting louder
USE A MAC DENNIS
Interesting, it must be a chat ghost
 
(flagged as offensive)
3
 
u_u
 
I just completed my switch from Ubuntu to Debian. Couldn't ask for a better OS. :P
 
4:17 AM
But I thought you loved Ubuntu??
 
uh, sure? Not saying that Ubuntu is bad
 
What made you want to switch?
I bet Debian doesn't have the Unity interface, which is probably one of the things I like most about Ubuntu.
 
I realized that there's a bunch of extra stuff in Ubuntu that I don't want, and then I realized Ubuntu is basically Debian plus that extra stuff
 
After a restart a couple of days ago, audio was gone and I couldn't tether my phone's internet connection anymore. So I updated everything, and audio and tethering are back. But: Chrome randomly replaces some SE avatars (preferably mine) with an odd version of someone else's. Right now, my avatar is an upside-down bird...
@AlexA. Correction: That is the worst part about Ubuntu.
 
@AlexA. Unity? I don't even use a desktop environment. (Under Ubuntu, I ran i3 under GNOME. Now I figured out how to run plain i3.)
(also, Unity is horrible)
 
4:19 AM
^
 
:/
Well, I like Unity.
Also what is i3
 
Anonymous
Congrats, you're the second person I've heard say they like Unity
 
Anonymous
The first was a Unity dev
 
ಠ_ಠ
@Doorknob What extra stuff?
 
4:22 AM
@Dennis I'm just waiting for some free time to switch to openSUSE, which works incredibly well with my laptop. Fedora 20 was great, but 21 has been a PITA ever since I upgraded... :(
 
@AlexA. ... basically everything that makes Ubuntu different from Debian >.>
 
@Doorknob Oh jeez, that looks like the kind of crazy hacker computer thing you'd see in movies.
@Doorknob I'm not familiar with the differences, that's why I ask.
 
You know that Ubuntu is a fork of Debian, right?
 
Yes
 
Anonymous
Aren't all distros, at some point, a fork of Debian and/or BSD?
 
4:25 AM
Well, actually, mostly what made me start to consider switching was all the shady commercialized stuff Canonical had been doing lately. Then I started to look into the differences, and I realized that mostly everything that annoyed me about Ubuntu was actually a thing that didn't exist in Debian.
And of course Debian is faster, more stable (although I am on sid (unstable)), has waaay less bloat, doesn't try to be "user-friendly" (aka get in the way), etc.
 
Anonymous
I switched off of Ubuntu main when GNOME 3 came out, couldn't stand it
 
Anonymous
Nowadays I use Debian and sometimes Xubuntu
 
@orlp I found where I learned that GCD(a R, N) == GCD(a, N): http://langevin.univ-tln.fr/cours/MLC/extra/montgomery.pdf
*"Also unchanged are the algorithms for subtraction, negation, equality/inequality test, multiplication by an integer, and greatest common divisor with N."*
 
Anonymous
xfce desktop makes me very happy
 
@Doorknob Shady stuff?
 
4:28 AM
yes. Some people have gone so far as to call Ubuntu "spyware"
 
I know about the Amazon thing and I disabled that ASAP when I created my Ubuntu VM. Is there anything besides that?
@Mego Puppies me make very happy
 
@AlexA. yeah, much more
 
Well shit.
Do you think ElementaryOS, which is based on Ubuntu, has similar commercializations?
 
uhhh, no idea, but I would assume not (considering it's Canonical / Shuttleworth who are doing everything)
 
(It's not backed by a big company like Canonical so my guess would be no but I really don't know anything about Linux anything)
Oh, okay
 
Anonymous
4:31 AM
@AlexA. xfce with puppies desktop background and app icons
 
@Mego Xylophone Farts Carry E. coli.
 
Anonymous
Sure
 
TIL that I don't really know APL.
4
A: Illustrate the square of a binomial

ZgarbJ, 12 bytes - 3 = 9 (,~*/,)&($~) This defines a dyadic (meaning binary) verb, used as follows: 4 (,~*/,)&($~) 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 I also claim the 3-byte bonus...

 
@Dennis DYK APL != J?
 
Yeah, sure. But the shortest APL code I can come up with is 31 bytes long...
 
4:40 AM
Can you translate that J solution directly to APL? I don't think APL has an equivalent for some of the stuff in that solution.
 
I've been trying. So far, I was unsuccessful.
 
Dammit @Doorknob. Now I have to rethink my choice of virtual machine. ಠ_ಠ y u b so smrt n helpfull?
 
im a smrt
 
Yay blue streak!
 
Anonymous
da ba dee da ba die
 
Anonymous
4:44 AM
oops
 
@Dennis Just because Zgarb posted a badass J solution that doesn't translate to APL doesn't mean you don't know APL. :)
 
uh oh, better make @Mego a mod to continue the streak :P
 
Anonymous
That is absolutely not in your best interests
3
 
:D
 
They made me a mod and look where that got them.
 
Anonymous
4:48 AM
Apparently it killed chat
 
Yes
 
¯\_(ツ)_/¯
egh
 
Boldly shrugging
 
this chat is overwhelmingly blue as always
mods --- mods everywhere
 
Anonymous
Boldly shrugging where no man has shrugged before
 
Anonymous
4:50 AM
Shrug Trek: The Next Shruggeration
 
5:13 AM
@Sp3000 here's a 129 using a more complicated approach ideone.com/wu6JRa
is it for a question on this site?
 
Lot more complicated :P
Nah, just one of Calvin's chat minichallenges
 
ah cool
 
Anonymous
I reiterate my previous statement
 
Anonymous
2 hours ago, by Mego
Loops? We don't need no stinkin' loops!
 
updated to 126
 
Anonymous
5:22 AM
Why does it take input?
 
because shorter
 
Assumes...zero on EOF?
 
@2012rcampion that's not the same
what montgomery is saying is that the algorithm for adding numbers in montgomery form is the same as adding regular numbers
that's not what I do in my pollard-brent implementation though
I never convert the numbers to montgomery form, and yet it still works
 
@orlp Oh, I get it now!!!! You're basically doing regular arithmetic but adding factors of R^-1 on every multiplication, which don't affect the GCD. That's quite clever!
 
5:29 AM
@2012rcampion correct :)
that's the funny observation I tried to convey yesterday :P
 
@orlp I was pretty tired, guess I missed it.
 
119 now, feels pretty clean, maybe there's a nice way to improve
 
Simple challenge idea: insert comparisons between integers
e.g.
input
2 6 2 1 6 4 4 2
output
2 < 6 > 2 > 1 < 6 > 4 = 4 > 2
too simple for PPCG?
 
@orlp Actually, isn't the only place that we actually convert into Montgomery form the initialization?
 
@2012rcampion yes, it's not a massive speedup, but it's still there :)
it's more of a cool thing
@2012rcampion another cool thing in my code is that I have simplified the addition code
 
5:42 AM
@orlp More importantly it gets your your RNG for free
 
I've changed all adds to +1
and I do not handle overflow at all
this will 'invalidate' a tiny, tiny portion of runs
however, since pollard-brent is a probabilistic algorithm, it doesn't matter for correctness at all
and actually handling the overflow is slower than just accepting you'll lose some iterations to it :)
 
@orlp By "changed all adds to +1" do you mean that you use f(x) = x**2 + 1?
 
@2012rcampion not really
it's hard to express mathematically
@2012rcampion let's say S = R^(-1)
then a proper formula would do montmul(xS, xS) + 1S to get (x^2+1)S mod N
what I do is montmul(x, x) + 1
1. I never convert x into xS (montgomery form)
2. To properly add 1 to a montgomery number, you would need to add 1S, I don't, I add 1
adding 1 is effectively like adding a big number
@2012rcampion effectively, my implementation is incredibly 'buggy', but because of some nice GCD identities and some RNG, it's just as correct while being faster :)
 
@orlp OK, so basically you choose x0 = 42 * R^-1 and f(x) = (x^2 + 1) * R^-1, both of which have no affect on the algorithm. Neat!
 
@2012rcampion not quite
x0 is 42
period.
 
5:55 AM
Actually I don't have to worry about overflow, since I add R mod N to the product before reduction; since b < N, b^2 + (R mod N) <= (N-1)^2 + (N-1) = N*(N-1) < N*R, so the reduction step still works.
@orlp I mean, x0 in the "proper" algorithm that converts everything to Montgomery form first
 
@2012rcampion you have to understand though, that if you do not convert a number, it effectively becomes an entirely different number if you then treat it as if you converted it
consider you have x. If you treated that x as z*Y for some constant Y, then effectively z = x*Y^(-1)
 
@orlp Right, I'm saying that it's as if you started with x0 = 42 * R^-1 and then converted it to Montgomery form (to get x0' = 42)
 
(alternate 128 using a more boring approach ideone.com/DoNtXI )
 
@2012rcampion if I'm not mistaken it's as if I started with 42 * R, not 42 * R^-1
but it's been a while since I last messed with montgomery, so I might be wrong
 
@orlp You multiply by R to get to Mongomery form, so you get x0' = x0*R = (42*R^-1)*R = 42
 
6:04 AM
...what are you guys talking about? Can't quite figure it out.
 
Anonymous
Math, not even once
 
@El'endia What happens when you combine Montgomery multiplication and rho factorization
More specifically neat optimization tricks
 
@El'endiaStarman A fast implementation of pollard-brent that was very similar between 2012 and me: github.com/orlp/libop/blob/master/bits/math.h#L594
 
@xnor Not a fan of your BE -> AE edit. Since the rest of the post is still BE, I'm reverting. ;)
 
@2012rcampion did you also take a look at math.stackexchange.com/questions/1251327/… ?
 
6:08 AM
@2012rcampion So, basically, you factor numbers with (relatively) small prime factors even faster by speeding up the modular multiplication?
 
@El'endiaStarman montgomery multiplication is pretty much universally used in the prime field... field
 
ahh, okay
 
prime ring? prime field?
I forgot which
either, way, finite fields mod p
 
@orlp Yeah, I thought that was cool too. I thought about using a multiplication-based division check, but the method I came up with involved two multiplications and one comparison, so I only saved a couple of cycles.
Adding another five-cycle table lookup sort of negates the benefit though.
 
@2012rcampion there's no table lookup
you just hardcode the constants :)
 
6:15 AM
@orlp Then you're adding an extra four-byte overhead per prime instead (for the load instruction), plus you're forced to unroll the loop. I was getting pretty tight on space, so I decided to keep the small primes in a table.
 
m/n	1	2	3	4	5
1	1	2	6	24	120
2		24	112	768	5376
3			376	2160	5904
4				20352	86208
5					51840
 
@El'endiaStarman ?
 
@Sp3000, @feersum, @Calvin'sHobbies: Table of how many valid grids there are for width m and height n.
 
what is a valid grid?
 
Anonymous
@El'endiaStarman I missed that convo, what's it about?
 
6:19 AM
@orlp, @Mego: Grid of integers, all distinct, where every 2x2 block adds up to the same sum.
6 hours ago, by Calvin's Hobbies
00 03 04 07
12 15 08 11
01 02 05 06
13 14 09 10
(sum = 30)
^ Example 4x4 solution.
 
OK, I replaced N with W and H in my program.
I get 5904 for 3,5
 
@El'endiaStarman I'm missing a piece of information
 
86208 for 4,5
 
@El'endiaStarman because there are at least an infinite amount such grids on 2x2
 
Anonymous
Sounds like subset-sum
 
6:21 AM
Something looks really long there
 
.....dang. Your C code is so much faster than my Python code. :(
 
@orlp Integers 0 to W*H - 1
 
@orlp Yes. ^ that
 
@Sp3000 tadaa, the missing piece of information :)
 
Of course. Even dumb C code will always beat Python.
 
Anonymous
6:22 AM
@El'endiaStarman run it with pypy
 
@El'endiaStarman Cython it
 
Anonymous
Or Cython
 
Neither of which I've used. How do?
 
Anonymous
Pypy is simple
 
Anonymous
Install it and run it
 
6:22 AM
@El'endiaStarman PyPy requires less work
Cython is very interesting though
 
Anonymous
 
PyPy's one thing. You still need a good algorithm though :P
 
I'm pretty sure @feersum and I are using basically the same algorithm though.
 
Anonymous
Cython actually compiles your code into C where possible, and runs that native
 
@El'endiaStarman the cool part about Cython is that you can compiler your Python code to C
 
Anonymous
6:24 AM
iirc
 
you provide type annotations to make sure the tight loops run at C speed
 
Anonymous
What algo are you guys using?
 
Brute force.
 
Anonymous
Ahh, the best algo
 
Anonymous
Permute over [0,N)?
 
6:25 AM
Not idiot force.
 
@Mego Loop through all permutations of first row, first column, and (1,1). Every other entry in the table is uniquely determined, so it just comes down to checking 0 <= x < W*H and x is unique in the table.
 
Anonymous
Ahh
 
Anonymous
Clever
 
No, I'm not doing that.
 
If feersum isn't using that algorithm, that'd probably speed up his code massively.
 
6:26 AM
I'm filling them in in reading order.
 
This algorithm has to be better
 
It's at least an order of magnitude better.
 
because for 5x5 there are 25! / 10! = 1e13 starting positions for yours
no way my code could have finished in reasonable time if it was that bad
Mine is obviously suboptimal though
 
@feersum Err, 25!/15! ?
 
6:28 AM
^^ basically what I mean about PyPy being useless if you're algorithm's not good enough in the first place (fyi I terminated mine)
 
@El'endiaStarman Yes, that.
 
Anonymous
Hmm, thought
 
I should fill them in an order that generates more squares early on.
 
Do the grids wrap? E.g. is (0,0), (0, n-1), (n-1, 0), (n-1,n-1) a valid 2x2 subset?
 
no wrap
 
Anonymous
6:30 AM
What about doing subset-sum over [0,N), finding sums on [6,4N-6)?
 
Anonymous
And then if you can find 4 distinct ways to sum to the specified value, you're golden
 
@Mego I think I've thought of that. The problem is overlapping the 2x2 blocks.
 
Anonymous
Oh wait, that would only work for the corner blocks
 
Anonymous
I guess find the 4-subsets for the sum, and see if there's any way to arrange them into a grid
 
Anonymous
But that's probably less optimal
 
6:32 AM
I tried doing that first.
Calvin's algorithm blew mine out of the water.
It didn't help that I was .pop(0)ing from a big list... :P
 
I think you wouldn't get any benefit out of such a precalculation.
 
I'm gonna try and fill mine diagonally and see if that helps. Might, might not.
 
@El'endiaStarman Given that you've already got a list of 3x3 templates, why don't you try to build those up instead?
 
@PeterTaylor Sums can be different.
And I think that would mean too many loops over the same list.
 
If you're doing, say, 6x6, then there going to be way too many valid 3x3 grids.
Since you can use 0-35 instead of just 0-8.
 
Anonymous
6:35 AM
How are m,n=1,1 and m,n=1,2 valid dimensions?
 
@Mego [0] and [0 1], [1 0], respectively.
 
All 0 of the boxes have the same sum.
 
@feersum If you put it that way, then I suppose m,0 would have m! solutions.
 
Anonymous
Then why are m=1,n>2 all 0?
 
@Mego It's impossible to have a list of distinct integers where every pair has the same sum.
 
Anonymous
6:37 AM
But you still have 0 boxes
 
I can't see it being other than m!.
 
Anonymous
And for all of the lists, all 0 of them have the same sum
 
I basically redefined the problem in my head...
I'll go fix that.
 
Anonymous
It should either be 0 (because no valid boxes) or n! (or m!, depending on which direction you go)
 
6:39 AM
There. Fixed. :)
I'm also completely fine with the idea of saying "it's undefined" for m or n less than 2.
 
Anonymous
I'm in the undefined camp
 
@MartinBüttner my apologies, I didn't realize it was a usage difference
*realise :-)
 
Holy balls...
 
Yeah, until you realize that that's applying to all the sites I go to on SE. I got the "trusted on the network" thing. xD
I still freaked out when I saw it.
 
6:50 AM
hehe
 
Seems still too small. Try registering on every site in the network right now.
3
 
Heh. "+4700" is not something I'll go for.
 
It always gives me a little jolt of pleasant surprise to see +100. Then I realize it's because I registered on another site and the happiness is muted... :P
 
Anonymous
@VTCAKAVSMoACE I ended up falling asleep then going to get groceries, so I wasn't around earlier :P
 
It's cool. I'm still doing homework anyways.
 
Anonymous
6:56 AM
Brb registering on every SE site I might find interesting
 
Awesome! Only took like 30 minutes to calculate m=n=4 with PyPy!
 
I think that was the one that took 61 milliseconds with C.
 
Gonna try it with Cython. :P
 
I think I had about 2 min with PyPy for that one
 
Wow, my computer must be slow.
(In comparison.)
 
Anonymous
6:59 AM
2300 network rep for joining the sites I actually frequently read :P
 
xD Point farming, much?
 
Anonymous
It doesn't actually matter for anything
 
Except chat.
IIRC users with 10,000+ network-wide rep can see and handle (or vote on?) chat flags.
 
So... sign up for 100 sites and you're good?
 
I think so, yeah.
 
Anonymous
7:13 AM
Aren't there only 47?
 
Erm. I picked an arbitrary number for "+4700", I have no clue.
149 sites.
 
Anonymous
So join all 149 :P
 
Anonymous
14.9k network rep instantly
 
Something tells me they'll pick up on that. :P
 
Anonymous
Being able to deal with chat flags is not something I want
 
Anonymous
7:17 AM
The less responsibility I have, the better
 
@xnor no problem
 
7:50 AM
0
A: Sandbox for Proposed Challenges

Pyrrhacode-golf Objective Given a grid of numbers, fill in the inequalities. Assumptions The number of columns and rows in the grid are equal. The grid will only consist of integers 0-9. Example Input 4 2 3 1 6 2 3 1 6 9 2 1 0 2 1 6 Example Output 4>2<3>1 ^ " " " 6>2<3>1 " ^ v " 6<9>2>1 v v...

 
Anonymous
if(a % 2 != 0) why are you giving me an error, js? I hate you
 
Anonymous
Apparently it wants !==
 
Anonymous
I hate javascript
 
8:15 AM
@orlp How the heck do I do this?!? I tried to gcc the .c file from Cython, but I get a ton of "undefined reference to _" errors.
 
Anonymous
Are you using the distutils method?
 
Yes.
 
That seems overly complicated. I just want to convert Python code to C code, then compile that and run it.
I'm not planning on distributing it or anything.
 
Anonymous
That's not quite how it works
 
Anonymous
8:21 AM
You build a C library with your code, that you then call from inside of python
 
okay
Let's say I have Python code in foo.py. I copy-paste that into foo.pyx. Then I cython foo.pyx and I get foo.c. Now what?
 
@El'endiaStarman the distutils takes care of all the stuff you need to link
but as an optimistic attempt, try gcc foo.c
 
@orlp It can't find Python.h.
Googling lead to this:
 
Anonymous
-I/usr/include/python<version>
 
Anonymous
So, for 2.7, -I/usr/include/python2.7
 
8:27 AM
gcc -IC:\Python33\include -LC:\Python33\libs foo.c -o foo.exe -lpython33
 
Anonymous
Or wherever your stuff is installed if not linux
 
Windows machine.
 
Anonymous
mingw or cygwin?
 
I'm using MinGW for the C compiler.
Although I also have cygwin, but trying the same thing in its terminal didn't work either.
 
Anonymous
You're seriously better off using this method
 
8:29 AM
Okay. I want to avoid clutter in my C:\Python33 folder, which is where all my scripts are.
 
@El'endiaStarman distutils doesn't automatically install
 
Anonymous
Make a subdir, use cythonize("../foo.pyx")
 
you can build without installing
 
Anonymous
For cygwin the proper gcc command would be something like gcc -I/usr/include/python3.3 foo.c -o foo -lpython3.3
 
Anonymous
Assuming you have python3.3 installed under cygwin
 
8:33 AM
I just installed cygwin like half an hour ago.
Well, "ImportError: No module named 'Cython'".
 
Anonymous
Did you install Cython via distutils?
 
Anonymous
python easy_install cython
 
Anonymous
Or pip install cython if you've installed pip
 
Installed it via pip.
Ah, it's over in Python35
"error: Unable to find vcvarsall.bat"
Aw c'mon.
 
@Dennis Would you mind sharing the code as well? ;)
Woooo, a new silver tag badge. :) ()
I didn't even expect that, because my profile was showing the progress for . Apparently it doesn't switch when another badge overtakes the current one in progress.
 
8:46 AM
0
Q: Huffman Encoded Golfing Language

ugorenHere's have an idea, which may save millions of bytes to golfers out there. But I'm not sure it's good. Take a language that's good for Golfing (e.g. Pyth). Take all existing CodeGolf answers in this language, and build a character frequency table. Build a Huffman tree based on this table. Crea...

 
Anonymous
Now JSHint is complaining about a switch statement...
 
Okay @Mego. Where do I find and then put vcvarsall.bat (or tell distutils/Cython where to find it)?
 
Anonymous
@El'endiaStarman Should be in your VS program folder
 
Okay, found a file with that name.
 
Anonymous
You're trying to build it with VC++?
 
8:59 AM
I don't know how to tell it to use MinGW.
"mingw" doesn't show up in the distutils setup docs.
 

« first day (1725 days earlier)      last day (3120 days later) »