« first day (1287 days earlier)      last day (248 days later) » 

4:13 PM
0
A: Sums of Consecutive Integers

PyGamer0K (ngn/k), 61 bytes h:{i{x':y}\:i:1+!x} f:{,//{~(#'x)=|/#'x}_,/{~x=+/'y}[x]_'h x} Try it online! This can definitely be golfed.

any golfing suggestions?
 
 
6 hours later…
9:51 PM
I ended up with this: ngn.codeberg.page/k/…
 
10:04 PM
8 bytes shorter: ngn.codeberg.page/k/…
I just posted because it’s a separate approach
 
10:18 PM
@PyGamer0 It looks like you calculated all consecutive runs, but k+(k+1)+...+(n-1) is just (!n)-!k. So to get a run, you just need a pair of numbers: the start and the end.
But even with your approach, if you just do ,/h@9 you get the list of all the runs in length order, so you could just do: g:{i@*|&x=+/'i:,/h@x}. to find the longest run.
 

« first day (1287 days earlier)      last day (248 days later) »