Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Timeline for Shift right by half a bit

Current License: CC BY-SA 4.0

7 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited Community Bot
Commonmark migration
Jan 24, 2020 at 12:53 comment added Kevin Cruijssen @Deadcode Ah, of course, \$<\$ vs \$\leq\$ is irrelevant, otherwise \$\sqrt{2}\$ would have been rational. Edited my answer. \$<\$ certainly saves bytes in my answer though, since I'd otherwise have to add a Duplicate, Jump if 0, and additional label which discards the duplicate before continuing with the loop (what I had in my initial 122 byter).
Jan 24, 2020 at 12:50 history edited Kevin Cruijssen CC BY-SA 4.0
Minor edit
Jan 24, 2020 at 12:35 comment added Deadcode Wow, very cool that the same (or very similar) algorithm is quite fitting in both regex and Whitespace. And ≤ vs. < is of course purely a golf optimization :) If it made a difference which you used, sqrt(2) would be rational. FWIW I mis-typed the LaTeX explanation – it really is ≤ in the regex. Oh, and if this is using the same algorithm as the regex, how come this rounds up and the regex rounds down? [Edit: Oops, rewrote this comment not realizing you'd already replied to it.]
Jan 24, 2020 at 12:34 comment added Kevin Cruijssen @Deadcode Also, Whitespace only has labels and jumps to labels to create loops and if-statements. The only jumps available are: jump unconditional; jump if 0; and jump it negative. Jump if positive is unfortunately not available (not really necessary, since one could use \$×-1\$ and then use the jump if neg. as alternative). Because of this I currently check whether \$(N+1)^2 - 2M^2 < 0\$ is truthy. If it is: continue the loop; if not: print \$N+1\$.
Jan 24, 2020 at 12:34 comment added Kevin Cruijssen @Deadcode Primarily because I would have to do an \$-1\$ after we've found \$N+1\$. So where your answer outputs \$N\,ドル mine outputs \$N+1\$ (excluding edge case \0ドル\$).
Jan 24, 2020 at 12:10 history answered Kevin Cruijssen CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /