« first day (1970 days earlier)      last day (3170 days later) » 

09:00
oh right, descending sortedness
did I get it backwards?
well if you just have lexicographic order and filter by sortedness and then take first, the result will also be sorted
oh yes
either you need the lexicographic order of the reversed lists, filter by sortedness and take first; or you need the lexicographic order, filter by descending sortedness and take last
Here's an even crazier characterization: Write each number 0 to 2**(2*n-1) in binary, keep only those with exactly n ones, and for each one, count the number of zeroes at the end plus one
09:08
:D
I'm sure eventually you'll find one that is golfy ;)
combinatorics is it own reward!
2
I'll stick with paths from (0,0) to (n-1,n+1) on a lattice grid :P
Is there a nice way to index into the n-size subsets of [1..N]? In other words, to get the kth one in lexicigraphic order without counting k steps?
can you find the kth number with popcount n?
ah, popcount was the term I was looking for
yes, that's the question
09:15
factorial base?
i know there's that nice way to iterate through numbers of a given popcount, but that's gonna be long
you don't actually want to iterate through them though, right?
right, i was hoping to extract it directly
interesting stuff you're talking about=)
I hope I do not interrupt, but it is a related question: Can you efficiently enumerate/generate all subsets of size k of some given finite set?
yes, that's the popcount enumerating algorithm
is this what you were looking for?
09:22
@xnor Crazy, it seems to work, but I have no idea why
I don't know, but the english Google translate voice always sounds like she has an attitude.
Is pop count short for population count?
@flawr roughly, given a subset, we can find the lexicographically next subset by including the smallest not-yet-included element to included, removing the next smallest currently include element, then making all elements below it as small as possible
by "lexicographically", here i mean if the elements were listed in decreasing order
@xnor Thanks, I think I first need to do some further reading=)
I can imagine an animation might help see what is happening
09:39
Found some sites that seem to explain it and added them to my TBR pile.
09:50
CMC: n minus each digit of n. For example, 123 becomes 123-1-2-3=117.
CJam, 8: ri_Ab+:-
Challenge idea: implement the Tiny Encryption Algorithm.
Matlab, 24: @(n)n-sum(num2str(n)-48)
@zʏᴀʙiɴ101 Please, no sandboxed post.
>>> f=lambda i:[i for i in range(1,i+1) for i in range(1,i+1) for i in range(1,i+1)];f(3)
[1, 1, 1, 2, 1, 1, 2, 1, 2, 3]
Python, abusing scopes like a champ
09:58
@xnor only works for 3?
I just wish we could do [*range(x) for x in range(i)] :P silly PEP clause not getting passed
@LeakyNun i'm planning on using eval to do the general pattern
@LeakyNun Oh look, this sandboxed post was posted on Jun 15 at 19:43 and it is Jun 21 at 13:58. I have to wait to claim this challenge.
Yeah, it will be hard.
@xnor Well, that would be repeating many answers already present.
o_O now that I look at it properly, xnor that's quite some scope abuse
10:01
@MartinEnder Why doesn't "map" or "each" work on strings?
i/ should convert each digit to integer?
:i
actually no
that converts characters to their character codes
:~
That's clever.
Why doesn't r_:~:+- work?
@xnor Bonus points if you f-string it for -1 byte :P
10:04
r_:~:+ gives 123 6, but r_:~:+- gives 123
@LeakyNun because there's no implicit string to integer conversion
so - is actually set difference there
@MartinEnder but it gives 6 already
you're trying to remove all 6s from the array ['1 '2 '3]
The 6 is already an integer
Oh, I forgot to make 123 an integer
So it would be r_:~:+\i\-
@Sp3000 3.6 is too cutting edge for me :)
10:06
:( but alpha's officially out now
@LeakyNun r_i\:~:+-
There's... an installer and everything :o
@MartinEnder Oh, nice.
@Dennis Not only is there a closed form for your "innovative" idea, but it also turned out to be a duplicate.
I think he noticed that by now...
Alright.
10:19
Question: Is x===~~x a valid test for integral numbers in JS?
@LegionMammal978 It passes my two testcases.
Why not just write x==~~x?
@LeakyNun Safety
@LegionMammal978 from?
(and consistency, it's used everywhere else)
0
A: Sandbox for Proposed Challenges

NeilExercise your kids I want you to output the nth verse of this kid's exercise song: Head, and shoulders, knees and toes, knees and toes, Head, and shoulders, knees and toes, knees and toes And eyes and ears and mouth and nose, Head, and shoulders, knees and toes, knees and toes. Each ...

10:25
@LeakyNun from JavaScript
@MartinEnder why?
because JavaScript's == is cancer
@MartinEnder do my challenge in your new language
Javascript ransomware was in the news recently
10:27
(if you have an hour of free time)
797
A: Strangest language feature

Chandra PatniJavaScript truth table: '' == '0' // false 0 == '' // true 0 == '0' // true false == 'false' // false false == '0' // true false == undefined // false false == null // false null ...

@LeakyNun which challenge?
@MartinEnder 123-1-2-3
oh
yeah I'm not looking forward to base conversion in that language :D
""==~~""
true
>> 'abc'==0
<< false
>> +'abc'
<< NaN
>> ~'abc'
<< -1
>> 'abc'==NaN
<< false
10:29
""===~~""
false
That's why
Can anyone tell me
why the **** do I get these results?
@LeakyNun You could call Ecma International at +41 22 849 6000
CMC: Check if everything in an array is equal to 1
Just wondering if the Jelly code ;1E could be golfed.
@LeakyNun Mathematica, 14 bytes: AllTrue[#==1&]
@LegionMammal978 Misplaced ampersand?
10:40
Hey, @Upgoat, been busy working on rationals
@LeakyNun No, ampersand is postfix operator for anonymous functions/lambdas in Mathematica
Isn't it always at the last?
@LeakyNun AllTrue can take an anonymous function and return a new anonymous function.
Whereas most Mma answers are just straight-up anonymous functions
(also, they're technically called "pure functions", but I come from a background in C#)
Oh, alright
@LegionMammal978 actually, I think "pure functions" are a bit misleading, because that usually refers to functions without side effects
@MartinEnder Yeah, but I didn't name them
In[1]:= AllTrue[#==1&][{1,1,1}]

Out[1]= True

In[2]:= AllTrue[#==1]&[{1,1,1}]

Out[2]= AllTrue[{1, 1, 1} == 1]
10:45
1<=##<=1&@@#& works, doesn't it?
Yes, it would
@MartinEnder why not just 1==##?
@LeakyNun Does 1.0 count as 1?
@LeakyNun umm...
yeah...
@LegionMammal978 whatever is more convenient
10:47
Can it take both?
In[3]:= 1.==1

Out[3]= True
I said, whichever is more convenient.
Because if we had to choose, then it would have to be 1===##
Kinda like JS in that respect
Alright.
So far: 1==##&@@#&
10:51
Why does Windows still have the option to run any executable in an email?
At least force it to be an attachment
(Then it would be the user's fault)
@LegionMammal978 Could you explain it to me?
@LeakyNun <func>@@#& is kind of like JS .apply, it uses a list as a function's arguments
1==##& just inserts == between its arguments, so 1==##&[{3,2,1}] would be 1==3==2==1
It's more complicated, but you get the point
@flawr It's not JavaScript. It's JScript, a server-side legacy .NET language with JS syntax.
@flawr Did you double up on @(a) in your answer or is it meant to be like that?
@LegionMammal978 alright, nice.
10:55
@Sp3000 That should indeed be there only once, thanks!
@mınxomaτ But it's close enough =D
Hmm does [[0,1,0];[1,-1,1];[0,1,0]] work? (should return truthy)
The thing with Mathematica is that everything is a function applied to arguments (or a number, or a string, or a symbol)
@flawr Well, actually no. The source explains that pretty well, but the BCC article implies ordinary browser-engine JS.
For example, 1==##&@@#& is actually Function[Apply[Function[Equal[1, SlotSequence[1]]], Slot[1]]]
@flawr Write a Cryptolocker in browser-JS and I'm impressed. Otherwise, this is not news. JScript cryptolockers have been around for more than a decade.
10:57
So pretty much a Lisp syntax replacement with pattern matching?
@LegionMammal978 Well, SlotSequence[1] is ## and Slot[1] is #, right?
@Sp3000 Let me check
What is @@ and &?
@LeakyNun Yes..
@LeakyNun @@ is Apply and & is Function
(and == is Equal)
Alright.
11:01
This has some interesting consequences:
In[4]:= 1==##&@@#&[[1,1,1,0]]

Out[4]= Equal
(i.e., the zeroth element of the first element of the first element of the first element of 1==##&@@#& is the symbol Equal)
0
Q: Downward Number Race

atlasologistYour task is to create a program that adds random numbers to previous sums in the ultimate number racing showdown. Each racer (column) starts at 0 and adds either 1 or 0 to the previous sum at each step of the race until all of the racers reach the score required to win. The 1 or 0 should be cho...

11:19
['^', (LHS, RHS) => {
    if (RHS.constructor.Name === "Number") {
        if (RHS.value === ~~RHS.value) {
            if (RHS.value < 0)
                return HelperInit(LHS.constructor, Math.pow(LHS.den, -RHS.value), Math.pow(LHS.num, -RHS.value));
            else
                return HelperInit(LHS.constructor, Math.pow(LHS.num, RHS.value));
        }
        else
            return HelperInit(CheddarNumber, 10, 0, Math.pow(LHS.num / LHS.den, RHS.value));
    }
    else if (RHS instanceof LHS.constructor) {
Rational exponentiation is irrational
@LegionMammal978 rational exponentation? Like a rational to the power of another rational?
In both ways
But a rational to the power of another rational isn't necessarily rational... why would you support that?
> irrational
adjective
3. not in accordance with reason; utterly illogical.
noun
8. (Mathematics.) irrational number.
So you have irrational numbers?
11:24
In both ways, yes
And thus, rational exponentiation is irrational.
Q.E.D.
Also, under what conditions does (a%b)/n = (a/n)%(b/n) hold?
Okay, I'll take that as a 2
11:47
@LegionMammal978 only by coincidence
unless you define / to be the inverse of multiplication in a finite field
I'm not talking about modular arithmetic here, I'm talking about % in the sense that pi%(1/2)=pi-3
that's still modular arithmetic, albeit an extension
Okay, then arithmetic in the interval [0,b) for a%b
@LegionMammal978 so if I understand your a%b correctly (assuming positive reals)
is the smallest possible number x left over after repeatedly subtracting b from a
11:56
ok
then let's say a%b is a - k*b for some integer k
(a-k*b)/n is what we have on the left side then
but if we divide both operands by the same number, we know that the process of repeated subtraction will stop with the same number k of subtractions
so we can rewrite the right hand side using the same k
makes sense so far
(a-k*b)/n = ((a/n)-k*(b/n))
So they would be equal.
if you now multiply both sides by n you'll see that they are always equivalent
yes
assuming both positive operands
Thanks, know some terminology but have never been much of a mathematician
12:00
so your "%" (often called fmod) can be distributed over by division
Yeah, was implementing rational mod but didn't want to go through finding multiplicative inverses
@LegionMammal978 You know, a%b = a-floor(a/b)
beware floor(-4.5) = -5
Eventually came up with (n1/d1)%(n2/d2) = ((gcd(d1,d2)*n1/d2)%(gcd(d1,d2)*n2/d1))/(d1*d2/gcd(d1,d2))
Which only uses integer %
so (a/b)%(c/d) = ((ad)%(bc))/(bd)
More like (a/b)%(c/d) = g((ad)%(bc))/(bd/g)
12:09
You can simplify the fraction later
@LeakyNun well
Have JS integer width to consider here, so I can't multiply huge numbers
that's the funny thing
you can choose different ways of truncating integer division
and those in turn determine the sign of a%b for when the signs differ
The outermost division of the RHS is actually my arbitrary-precision Rational type
So no integer division is necessary
12:17
ad < bc implies that a/b < c/d, correct?
Only if the signs of b and d are the same
(which they are)
Then yes.
And that applies to >, <=, etc., correct?
well just check that a and c are not zero and those nasty things
12:20
@LegionMammal978 yes, you can manipulate inequalities just like equalities
@LeakyNun You mean b and d?
except division/multiplication you need to flip the sign if you multiply/divide by a negative amount
It is equivalent to dividing both sides by bd
@orlp Yeah, was asking because that keeps catching me :p
@LegionMammal978 Well, all four of them.
12:30
@LeakyNun Why can't a or c be negative?
@LegionMammal978 Oh, I meant zero.
Well, I am not sure what 0%0 is
Oh, I'm talking about ad < bc → a/b < c/d
again, as long as the signs of b and d are the same.
12:32
Because I needed this today: Very fast float to int array conversion in C/++ with x86 inline ASM. It's usually min. 6 times faster because it skips the FPU pipeline flushing mandated by the C std.
@LegionMammal978 and neither b nor d is zero
12:44
@Upgoat I figured out a way to do what you were trying to do with Git: git rebase -i <commits> can actually squash commits together!
(Just read git-scm.com/docs/git-rebase for more awesome things it can do.)
Question: How does one get all accurate digits of a number in JavaScript?
12:59
Goin to the dentist
Chat is a big ole' heap of grey. Legion's avatar is just a white box for me, Leaky's is a broken image, and Minxomat's is greyscale. And then comes flawr busting up the combo.
13:16
cccccccombo breaker
@TimmyD Which part of my image is broken?
@LeakyNun Facebook is blocked here, so that's why.
@TimmyD where is "here"?
work
I see
13:24
@LeakyNun Actually I don't know why, but your avatar does seem a bit weird on some browsers (Chrome here)
@Sp3000 Seriously, maybe because it is imported from Facebook
Woop, yes that does seem to be the problem
Just turned off Disconnect (browser extension) and it showed
@Sp3000 Wait... It's disappeared even more than mine has!
(Works fine for me using FF)
I blame cache
I cannot see mine on the left of the text box
Weird ... www.shouldiblamecaching.com doesn't exit (DNS lookup error). -1 for lack of standards support
@TimmyD Not on their end
I don't understand what you mean by that.
It's your problem, not theirs
@TimmyD For me, it works fine.
13:42
It's my problem that they're not publishing a WWW record?
@LegionMammal978 Yes, according to caching.
@TimmyD There's no www. at the front.
Right. That's my point.
I too get a DNS lookup error if I try www.shouldiblamecaching.com, but not if I try shouldiblamecaching.com.
13:44
@LegionMammal978 Right, it returns the SOA record, equivalent to "Does Not Exit"
Oh, I see
So it doesn't support www.
Right
Blame FF for being misleading then
(And blame caching, that's what it tells me)
@MorganThrapp Ooo, 400 bytes is agonizingly close
@TimmyD You're telling me.
Only 3 bytes to go!
If I didn't have to pad the time, I'd have it already. :P
14:02
I had an emergency outage at my home a few hours ago because the AC had nowhere for the water to flow.
Anyway, it's now safe for me to use the computer. :)
@zʏᴀʙiɴ101 mon
@TimmyD Check it! 392!
@Poke mon
Wait, oops, hang on, broke it.
Pro tip: a blank FM radio frequency is a decent random number generator.
I took 20 seconds from a blank FM radio frequency with my trusty-dusty Lenovo smart phone.
And now parsing the result.
14:11
Pro tip: a GPS signal is a decent time function.
Yes, because some phones come equipped with a "Sync time via GPS" function.
Well, GPS has perfect accuracy, running on an atomic clock to measure the exact SI second
Actually below 400 now! 397!
@MorganThrapp What are you talking about?
@Upgoat htf did i come online
i was probably either puking my guts out or sleeping
14:20
@LegionMammal978 The FAT32 thing, I was hovering right around 400 bytes last night and I finally got below it.
@LegionMammal978 @TimmyD's challenge
@MorganThrapp Nice.
@Upgoat Tor stopped working, and the proxy settings screwed stuff up.
Chrome alternated between france, germany, and japan. wtf
@MorganThrapp To be fair, it's not really FAT32. There are a lot of additional specs that I pared out to make it a decent challenge (as opposed to writing a whole file I/O subsystem as an answer).
14:30
@TimmyD Shhh, let me have this moment. ;)
It was actually really interesting, because I've always been interested in how file systems work, but not interested enough to read about them.
Well, we've come a long way in file systems since this challenge's spec, which is a trimmed down version of FAT16
I mean, FAT16 came out over 30 years ago
Anyone knows this fractal?
Because I don't
Oh yeah, that's Frank. Good guy, 2 kids.
@MorganThrapp Much funny. Very laugh
Hmm ... neither TinEye nor GRIS come back with a result.
14:36
Any advice for this?
2
A: Sandbox for Proposed Challenges

Eᴀsᴛᴇʀʟʏ IʀᴋDo not repeat yourself metagolf Given a number m, output a program that prints out the string Do not repeat yourself. Now for the challenging part: Each program the original code prints out has to have the byte at place m*n be the same as m*n - 1 and the same as m*n - 2 .... all the way down t...

@Bálint looks kinda a weird koch snowflake
@EᴀsᴛᴇʀʟʏIʀᴋ Yeah, the genration is pretty similar, but instead of putting triangles on triangles, I put circles on circles
@Doorknob I got that far
It's kind of hard to explain
(removed)
how do grey text chat
Here, with better sample size
Is there a list of fractals online?
> Best guess for this image: monochrome
@BaldBantha 0/10 brb remvoing
It's on my fork
14:52
so you can't remove it
right?
brb warning @Upgoat DON"T MERGE ANY PR's FROM EPICTCK
I don't want him to merge it, I would have made a pull req in that case. I just wanted to fork it and mod it to my liking, as the license lets me
@BaldBantha Li cense.
Without the s.
Nothing
I may have just found an unnamed fractal
14:54
@Bálint name it after yourself
@BaldBantha I don't think you can without publishing it
...? so you have to publish a paper about it?
@BaldBantha license says either delete that repo or put a NOTICE.(md|txt) file that says you don't own it.
@BaldBantha Yeah
14:57
@EᴀsᴛᴇʀʟʏIʀᴋ DANGIT y no MIT licence
I don't think you can just register it
I may ask the mathematics SE
brb deleting repo
@BaldBantha ^^^
@BaldBantha it's fine, just add 1 simple txt file
14:58
and say "i don't own this"?
yeah
"I don't own this, all credit goes to XXX YYY the Goat"

« first day (1970 days earlier)      last day (3170 days later) »