« first day (28 days earlier)      last day (1299 days later) » 

2:12 AM
@Grimy Wow, awesome.
@Grimy But isn't the memory method screwed up after running backref-adjustment.sh?
 
 
1 hour later…
3:40 AM
=
 
 
3 hours later…
6:35 AM
I don’t use backref-adjustment.sh
 
 
1 hour later…
7:54 AM
Well you use some script to do it, right?
 
8:27 AM
Nah, just Vim's built-in ctrl-A / ctrl-X
Also I missed the obvious 379, just delete the first x
 
Wow, so that's 24.76% off, rounded to the nearest.
Why replace each backref number one by one when backref-adjustment.sh can do all the appropriate ones at once?
 
Hehe
Yeah the script is probably faster starting from 10+ backrefs, but I just got used to doing it in Vim
 
8:48 AM
Wow, the 384 char version is much faster than the 504 and only about half the speed as the 537 (this is assuming RME does the optimization it currently doesn't), but the 379 char version is hugely slower. Interesting. I'll bet that introducing an optimization that looks past negative lookaheads to evaluate the faster condition that follows them first would bring back the speed.
For example making (?!(xx+)(?!\16+$)\18+$) act like (?!(xx+)(?=\18+$)(?!\16+$))
Well maybe not
 
Yes 381 -> 380 was an expected slowdown
380 -> 379 shouldn't change the speed at all though
 
May I see the 381 please?
 
10 hours ago, by Grimy
Whoops, there you go: https://pastebin.com/raw/S5VkQJf4
 
Oops, I got confused. Thought that was the 384, but you sent that too
 
Hmm actually 381 might've already been slow, in which case what caused it was
384->382 (I didn't post or save the 382, but 382->381 is trivial, just changing two () to (?:))
 
9:03 AM
No, just changing two () to (?:) is 384->383
And it looks like you missed a comment. # \7 = N / \1, \6 = \7 - 1 -> # \6 = N / \1, \5 = \6 - 1
How could that happen? Does the Vim replace command you do skip over comments?
 
No no it was definitely 382->381 for me (though of course it would also work starting from the 384)
And yeah idk how that happened
 
9:18 AM
@Grimy Er, right. But 383 would be the shortest non-slowed-down version, right?
Oh, 382
 
By removing the first x?
 
Yes
 
Yup, sounds right
 
No! I removed the second x!
 
Nooooo!
 
9:28 AM
(=
 
(When I remove a paren pair, I always remove the closing paren that matched the opening paren, even when multiple consecutive closing parens make that irrelevant)
 
And (?=\6((x+?)\1+$)) -> (?=\6((x+?)(?=\1+$).*)) is the edit that makes it behave as it would be RME had the optimization I plan on giving it
@Grimy I don't always do that. But sometimes I copy and paste something short rather than retyping it, just to be 100% sure instead of 99.999% sure there's no typo.
 
99.999% sounds like overconfidence, my typo rate is way above 1 in 100000 words =p
Looks cool
 
Oh sure, so is mine, but I mean after I look at what I typed and correct it if I notice a typo
basically I mean unnoticed typos
Yay! Something that's actually a decision-problem and not sequence
I accidentally did a sequence problem and deleted it after realizing
codegolf.stackexchange.com/questions/180693/jumping-numbers/… (answer only visible to me because it's deleted)
^((?=(x*)(\2{9})(x*))\3(?=(\4(x{10})*)(x*))(?=x\5\4$|x\2\7$|\4$)\4)*$
In a way, this uses the same trick as your version of Rude Numbers.
 
9:57 AM
And yeah jumping number would've been cool as a decision problem
If you remove the initial ^, given the nth term of the sequence, the regex
outputs n (via the number of matches), but that's still backwards compared to
what's asked
 
10:11 AM
@Grimy 60 chars
 
Good good
 
10:24 AM
0
A: Is it a Cyclops number? "Nobody" knows!

DeadcodeRegex (ECMAScript), 60 bytes The input \$n\$ is in unary, as the length of a string of xs. This works by finding \$z=2^{\lfloor log_2{n}\rfloor}\$ (the largest power of 2 not exceeding \$n\$), then asserting that \$z\$ is a perfect square while taking its square root, and finally asserting that...

 
58
 
Based on mine or yours?
 
Neither
Third method
I assert N = k * (2k + 2), with k a power of 2 - 1
 
59? I thought you said 58?
 
58 was without ^
Which works in RME for some reason
I think this method can get lower, but afk to eat (=
 
10:39 AM
@Grimy (2^k - 1) * (2^(k+1)) is wrong, though your regex is right
it goes 4, 24, 112, 480, instead of 5, 27, 119, 495
@Grimy It does not work in RME without the ^, nor should any decision-problem
Without the ^ it returns the largest cyclops number not exceeding the input
 
11:07 AM
The correct formula is (2^k - 1) * (2^(k+1)+1)
Did you discover this formula independently or borrow it from Neil's batch answer?
 
Independently
And yes I off-by-oned this
It sure works in RME
echo 'x$' > one
seq 1000 | regex -nx --fs+ -f one
outputs only 1 for me
It gets more obvious with --verbose:
1 -> 1
2 -> no match
3 -> no match
4 -> no match
...
 
Why are you using seq?
 
Same result with perl
 
$ ./regex -nx 'x(x*)((\1\1xxx)x)(?=(\2*)\3*(?=\1$)((x*)(?=\6$)x)*$)\2*$\4' -t 0..120
5 -> 5
6 -> 5
7 -> 5
8 -> 5
9 -> 5
10 -> 5
11 -> 5
12 -> 5
13 -> 5
14 -> 5
15 -> 5
16 -> 5
17 -> 5
18 -> 5
19 -> 5
20 -> 5
21 -> 5
22 -> 5
23 -> 5
24 -> 5
25 -> 5
26 -> 5
27 -> 27
28 -> 27
29 -> 27
30 -> 27
31 -> 27
32 -> 27
33 -> 27
34 -> 27
35 -> 27
36 -> 27
37 -> 27
38 -> 27
39 -> 27
40 -> 27
41 -> 27
42 -> 27
43 -> 27
44 -> 27
45 -> 27
46 -> 27
Have you never used the -t parameter?
 
Sure
 
11:22 AM
Well then, why?
 
But it only handles consecutive numbers, stdin is more generic
 
But you're doing consecutive numbers anyway
 
Yes but I'm not gonna switch the script from one to the other every time
 
Anyway, using stdin it still doesn't work without ^
 
Was this fixed recently? I'm using a sorta-old commit
 
11:23 AM
2 -> no match
3 -> no match
4 -> no match
Did you extrapolate from that to say that it works for all numbers?
Of course it may seem to work for those, as they're less than 5
 
This is running on the x$ regex
 
What x$ regex?
I'm using the one in your latest-edited answer with the ^ removed
 
I'm using x$
Literally that regex
seq 10 | regex --verbose -nx 'x$'
 
x$ does not test for cyclops numbers
 
Of course it doesn't
But it should match any number >= 1
And it doesn't
 
11:26 AM
So? What are you trying to show?
 
That RME has weird behavior when running on STDIN
 
Not on my end
 
So when you run `seq 10 | regex --verbose -nx 'x$'`, you don't get
```
1 -> 1
2 -> no match
3 -> no match
4 -> no match
5 -> no match
...
``` ?
 
$ seq 10 | ./regex -nx 'x$'
1
1
1
1
1
1
1
1
1
1
 
Alright, so it was fixed recently
That's what I was asking
 
11:27 AM
You're using a really old version? Why?
I didn't fix that recently (or at all, ever – I don't recall it ever having that bug)
 
"really old"
like a few weeks
 
Nope
What are you compiling it with?
 
gcc
 
How come you're getting ` -> ` in the output when using stdin?
It does not do that
And never did
 
My version does, and it's from Feb 5
 
11:29 AM
Maybe you modified it to do that, and introduced the bug yourself?
 
I didn't touch it
 
Oh, --verbose, forgot about that
$ seq 10 | ./regex --verbose -nx 'x$'
1 -> 1
2 -> 1
3 -> 1
4 -> 1
5 -> 1
6 -> 1
7 -> 1
8 -> 1
9 -> 1
10 -> 1
 
$ seq 10 | regex --verbose -nx 'x$'
1 -> 1
2 -> no match
3 -> no match
4 -> no match
5 -> no match
6 -> no match
7 -> no match
8 -> no match
9 -> no match
10 -> no match
(after updating to the latest master commit)
 
@Grimy What version of gcc?
 
4.8.5
Yes that is antique x)
 
11:35 AM
That's very very old yes
It works correctly with 5.3.0
Still I'm curious why exactly 4.8.5 breaks it
What if you compile it with -O0?
Or -O1
 
With -O1 it works, with -O0 it still fails
 
Wow, weird
 
Yes, -O0 and -O2 have the same behavior but -O1 is different
This is amazing
 
Is it behaving exactly like it always has an implied ^ at the beginning?
in the broken versions
 
Hmm how would I test that?
Okay in the broken versions \B never matches
So yeah seems like an implied ^
 
11:40 AM
What about in strings mode?
 
Works fine in all versions
Wait no works fine in -O2 and -O1 but not -O0
This is reaching new heights
 
o_O
@Grimy What if you add anchored=false; to the RegexMatcher<false and true>::RegexMatcher() constructors?
@Grimy Wow, it's a real bug. RegexMatcher::anchored is an uninitialized variable. Good job finding this.
 
Yatta
And yeah it works fine with this addition
 
12:05 PM
BTW, that explains why it'd still be broken with -O0. In that mode it probably intentionally initializes uninitialized variables with a test pattern.
And this bug only happens for test inputs after the first input.
Because virtualizeSymbols() initializes the "anchored" variable, but the symbol virtualization is subsequently cached and doesn't need to be recalculated, but a fresh RegexMatcher object is created for each input, thus "reinitializing" the "anchored" variable
 
1:02 PM
@Grimy Golfed mine down to 58, and it is almost certainly robust, but I haven't proven why yet
 
Nice! I'm currently playing with a 53 that matches cyclops numbers + 1, fairly sure it can be made into a correct < 58
 
@Grimy Wow, cool :) Meanwhile I explained why the 58 works.
 
You can drop the first ? for a 57
And it works for the same reason backtracking doesn't break it
 
Oh right! Good catch
 
1:17 PM
I can now match cyclops numbers + 2 in 52. This is the opposite of progress.
 
LOL. D'oh.
 
Could be 57 with a fixed-length (?<=), but of course that isn't allowed
 
What's the smallest you've gotten it so far?
 
Still 59 :|
I have 5 variations at 59 or 60 that all feel improvable
But no dice
Oooh 57
 
1:36 PM
:D
What is it?
Have you proved it?
 
It is ^((((x*)xx)\3)x)(?=(\1*)\2*(?=\4$)((x*)(?=\7$)x)*$)\1*$\5
And I very much haven't
 
 
1 hour later…
2:37 PM
Also int f(int n){int k=n^-~n;return n==k*(k+1)/2-1;}
Direct port of Neil's answer
 
3:29 PM
0
A: Is it a Cyclops number? "Nobody" knows!

GrimyC (gcc), 26 bytes f(n){n=~n==(n^=-~n)*~n/2;} Try it online! Port of Neil's answer. Relies on implementation-defined ordering of operations. C++ (gcc), 34 bytes int f(int n){n=~n==(n^=-~n)*~n/2;} Try it online! Can't omit the types in C++, otherwise identical.

 
3:48 PM
@Deadcode I get a segfault from RME with ^(x*?)(?=\1)
 
I can reproduce this
In both numerical and string mode
echo | regex '(.*?)(?=\1)'
Segmentation fault (core dumped)
 
 
2 hours later…
5:59 PM
@H.PWiz Thanks :) Fixed.
 
6:10 PM
Here is my Cyclops regex: ^((?=x(x*?)\2(?=(x+)\3$)((x+)(?=\5$))*x$)\3\3(?=\3)x\2)*x{5}$. (61 bytes, doesn't match 0). Possibly improbable, but I'm on my phone. If anyone finds improvements, feel free to hijack it
*improvable
I don't need the first $
 
6:34 PM
@H.PWiz Interesting! I think Grimy used a similar method for his first solution (step down consecutively through the smaller cyclops numbers until reaching 5) but his was 65 bytes. However, note that we didn't know at that point that zero was required to return truthy, so his 65 would really be 68 and your 60 is really 63 due to the needed |^$.
 
6:45 PM
I have this now: ^((?=x(x*?)\2(?!((xx)+x)\3*$)(x+)\5)\5\5(?=\5)x\2)*x{5}$. Very hard to golf on mobile
 
@H.PWiz Wow! Very impressive.
@H.PWiz ^(x(?=(x*?)\2(?!((xx)+x)\3*$)(x+)\5)\5\5(?=\5)\2)*x{5}$|^$ - now tying with Grimy's answer!
 
I might post an answer later tonight
^((?=x(x+?)\2(?!((xx)+x)\3*$)(x+)\5)\5\5(?=\5)x\2|x{5}$)*$. Maybe
 
7:15 PM
@H.PWiz Wow, it seems all of our methods have converged to 58 bytes! Mine, Grimy's, and yours. Amazing!
Also, I wonder who relinquished their upvote from my answer. It was at 5 and went back down to 4 about four hours ago.
 

« first day (28 days earlier)      last day (1299 days later) »