Jul 29, 2022 13:50
That seems like a sensible thing to think
Jul 26, 2022 17:52
In my regexes for 5 and 7, I have (||){1,4}, which can be (|){3,6} according to your list
Jul 26, 2022 17:48
Then you can take add 21*(n^2-1)*n, and then add n
Jul 26, 2022 17:47
We have n^7-14n^5+49n^3-36, so we add 14*(n^2-4)*(n^2-1)*n to get n^7-21*n^3+20*n
Jul 26, 2022 17:45
For odd powers, you can do something like x*x*x+x+x+x+ which gives (n-3)*(n-2)*(n-1)*n*(n+1)*(n+2)*(n+3)/7!. Then multiply by the factorial, and you get something like (n^2-9)(n^2-4)*(n^2-1)*n. When expanded all the terms have odd powers, and you can gradually improve it
Jul 26, 2022 17:41
@Deadcode No, that should be useful. Anyway, here's one for n^7 that I found manually (||||||)((||){2,5}(|)x*x+|(|)(||){1,4})x*x+x+x+|(|){1,6}x+x+|x
Jul 26, 2022 17:31
For n^7, I want to do 5040, and 1680, and ...
Jul 26, 2022 17:31
Have you got any method for figuring out how to multiply by n?
Jul 26, 2022 17:27
I haven't thought about it yet
Jul 26, 2022 17:19
The best way to analyze it is by looking at (|){2,3}x*x+x?x+|x?x+
Jul 26, 2022 17:18
@Deadcode Yes, I suppose you're right. The problem is, that you aren't really multiplying by n^2. That would be (?*(|){2,3}x*x+|)x?x+ (I think)
Jul 26, 2022 17:16
I think x*x+ shouldn't be (n+2)*(n+1)*n/6
Jul 26, 2022 17:12
> I saw that x?x*x+x+ gave me oeis.org/A002415
Jul 26, 2022 17:12
I tried to explain it above.
Jul 26, 2022 17:05
Odd powers can be nicer in some ways. For n^5 I've got (||){1,4}x*x+x+x+|(|){1,4}x+x+|x, but there should be a better way
Jul 26, 2022 16:14
The way I found this was by guessing random things... I saw that x?x*x+x+ gave me oeis.org/A002415, which looks pretty close to n^4. So I multiplied by 12, and added n^2
Jul 26, 2022 16:10
I'm not sure what the best way to multiply by 12 is
Jul 26, 2022 16:10
Which could be ((|){2,3}x*x+)?x?x+
Jul 26, 2022 16:10
((|||||||||||)x*x+)?x?x+ works for n^4
Jul 26, 2022 15:20
which I suppose is just (|||||)x+x+|x
Jul 26, 2022 15:19
I haven't thought very carefully about this problem... but while playing, I found x+((|||||)x+)|x for n³
Jul 14, 2022 14:18
I'm pretty certain my solution is correct... All of the ideas I've had to shorten it work much better in my imagination than in reality
Jul 14, 2022 14:18
I did... but I didn't wait for it to finish... how long should it take?
Jul 13, 2022 16:35
Yes, ask...
Jul 11, 2022 16:31
It fails for my cyclops regex on 3
Jul 11, 2022 16:24
Step 377: {14|39} \2="0" (32:1), \1="0" (13:1)
[2]: non-match
are the last two lines of --trace
Jul 11, 2022 16:22
> zsh: segmentation fault (core dumped) ./regex <<< '0000000000000000 + 000000000000000 = 0000000000000001'
Jul 11, 2022 16:16
nvm, I didn't recompile after pulling :)
Jul 11, 2022 16:14
git pull syas I'm up to date...
Jul 11, 2022 15:55
> Error: Unrecognized option "--test=binary-sum"
Jul 11, 2022 15:53
@Deadcode My first attempt gets me to 121... I need to think some more about this
Jul 11, 2022 02:57
When I was playing earlier this didn't work... I can't remember what the difference is
Jul 11, 2022 02:56
^(x(x*))(?<!^\3+(x+x))(?!(?=\1*(\1\2+$))\4*$)\1*$
Jul 11, 2022 02:52
So it beats .Net now!
Jul 11, 2022 02:51
I haven't checked what changed, but it seems that you don't have to worry about 1 anymore, and can start with (x(x*))
Jul 11, 2022 02:48
That's quite pleasing. I still feel uneasy with (?<!) for some reason. Even though it was introduced years ago
Jul 11, 2022 02:29
It's one of the trends on code.golf that I came to really dislike. A rather hilarious example of this strange thinking is here
Jul 11, 2022 02:27
It would be nice if you weren't allowed to invert the outputs... That way handling 1 becomes much easier
Jul 11, 2022 02:26
@Deadcode The way the question is worded makes the approach we both originally took seem very natural
Jul 11, 2022 02:25
I never learnt about the square regexes... nice work. shorter yet is: ^(x(x+))(?<!^\3+(x+x))(?!(?=\1*(\1\2+$))\4*$)\1*$
Jul 11, 2022 00:19
Actually, I can get 63: ^(x(x+))(?<!^\3+(x+x))(?!(?=x*(\1(?=(\1*)\2+$)\1+$\5))\4*$)\1*$ So it's 1char shorter than the one I gave you before... but I gets the answer wrong for 1
Jul 11, 2022 00:13
((x+)\5*(?=\5$))? seems like a really ugly construction. I want to do tail /= n where n is a (possibly 1) divisor of tail
Jul 11, 2022 00:09
And it thinks that 1 is Guiga
Jul 11, 2022 00:09
I was just trying a slightly different approach for Guiga... Right now it's 4 chars longer: ^(x(x+))(?<!^\3+(x+x))(?!((x+)\5*(?=\5$))?\1(?=(\1*)\2+$)\1+$\6)\1*$
Jul 11, 2022 00:07
I was just slightly annoyed that I couldn't test locally with ^(x(x+))(?<!^\3+(x+x))... I really like developing solutions by using ./regex
Jul 10, 2022 22:48
btw, are there lookbehinds in RegexMathEngine?
Jul 10, 2022 22:00
In general I don't have much interest in codegolf.stackexchange... I spend some time messing around on code.golf, and recently did a couple of regex-ish holes in Vim which tempted me to look here for a bit
Jul 10, 2022 21:58
I scrolled through a few, looking for some low-hanging fruit
Apr 13, 2021 14:40
Cool! I suppose it's not so common to divide by big numbers in regex.
Apr 13, 2021 00:51
After supposing B'>B?