Ørjan Johansen

 Primes and Squares

For discussion about programming, math, linguistics, music, sc...
Nov 21, 2019 06:13
@El'endiaStarman The probability that you still won't get one in the next 2000 is 1/e ~ 36%, which, when multiplied by the original ~ 30% probability of not getting one in the first 2400, gives ~ 11%, or the probability of not getting one in the total 4400. That's exactly the rule for combining independent probabilities.
Oct 27, 2019 23:50
CPS = continuation passing style
Oct 27, 2019 23:49
@EdgyNerd Every Underload command (ignoring exact S output format) translates directly to Smurf except for ^, which gets restricted to only be used at the end when there's exactly one element on the stack. So to make it work you need to (1) CPS transform the Underload program (2) reencode the Underload stack into a single string so it can be embedded in the continuation string called by x.
Oct 25, 2019 11:02
@EdgyNerd I think so too. I think you can also remove \ , since q and + can be used to construct the kind of strings you'd want it for.
Oct 25, 2019 00:18
(which btw shows that reduction can be faked in various ways, so t is probably unnecessary).
Oct 25, 2019 00:14
@EdgyNerd They're not TC. You have no way to do duplication. In fact the only way to grow the program state is q, but that uses up a q that you have no way of getting back. So the remaining program + stack have to shrink, eventually halting. t won't help you either. I think p and g are necessary but some of the rest might not be. You might want to look at my Underload :()^ minimization.
Oct 23, 2019 22:45
@DJMcMayhem Are you saying you want a pillow fight?
May 26, 2019 02:52
@PhiNotPi OK calculating speed is beyond my little knowledge of thermodynamics.
May 23, 2019 04:48
@PhiNotPi Right, swapping should be possible.
May 23, 2019 04:22
In which case your sqrt(XY) note seems like the thing.
May 23, 2019 04:20
Well you can only do that by heating the other.
May 23, 2019 04:07
@PhiNotPi You cannot use the heat differential between two objects to power heat transfer from the coldest to the hottest - that's pretty much one formulation of the second law. But you could use it as an energy source to cool a third object.
 

 Of Monads and Men

For discussion about, learning of and golfing in Haskell codeg...
Oct 10, 2019 01:28
Or loops and mutable variables.
Oct 10, 2019 01:28
In Python it would be easier though, since functions can have optional arguments.
Oct 10, 2019 01:24
@Khuldraesethna'Barya Oh I see, I read "helper function" as "predefined function".
Oct 9, 2019 04:42
(Without optimizations.)
Oct 9, 2019 04:42
Actually, technically laziness ruins it. Should have used the strict foldl'.
Oct 9, 2019 04:40
@Khuldraesethna'Barya No, it's easy to build a reversed copy on the fly while traversing an immutable original. In fact that's exactly what the standard definition of Haskell's reverse does. (reverse = foldl (flip (:)) [])
Sep 19, 2019 03:39
@EsolangingFruit R (B x R) is a fixpoint for x but I don't see how to get the x as the final argument.
Sep 19, 2019 03:28
di and id could be any single letter instead.
Sep 19, 2019 03:25
@Laikoni Thanks, I decided to post it.
Sep 18, 2019 00:08
(41 bytes)
Sep 18, 2019 00:07
Reversed niam=main;main=putStr$!"-1";1!$tnirp=niam
Sep 18, 2019 00:06
@Laikoni main=print$!1;"1-"!$rtStup=niam;niam=main
Sep 10, 2019 01:20
| ... <- is basically syntactic sugar for case ... -> ..., which doesn't.
Sep 10, 2019 01:17
let also allows types to be polymorphic.
Sep 9, 2019 22:51
@SriotchilismO'Zaic The y is not in scope on the right side of the <-, but is in scope on the right side of the =. (BTW f x|let(y,z)=(x,y)=z works.)
 

 The Nineteenth Byte

The Nineteenth Byte: General discussion for codegolf.stackexc...
Sep 11, 2019 02:16
Thanks
Sep 11, 2019 02:09
Since I can no longer unprotect questions, I tried to flag a couple days ago that codegolf.stackexchange.com/q/55422 needs to be, but no one has reacted :(
May 3, 2019 02:36
The logical solution is to get SE to rename to something abbreviating to PP.
Apr 27, 2019 22:17
Both. The 2 cannot be changed to 4 or 8, because 5 isn't divisible by 2 or 3. The 5 cannot be changed because 25 > 10.
Apr 27, 2019 22:03
And I suspect there won't be any large ones which do.
Apr 27, 2019 22:00
There are few enough candidates that you can use the logarithm method from the earlier challenge to estimate which ones might fit, though.
Apr 27, 2019 21:55
You also have to check if (c^d^e-1)/2 and (c^d^e-1)/3 are powers, for 9^4^ and 9^8^.
Apr 27, 2019 21:42
Oh, 1 is a theorem now...
Apr 27, 2019 21:41
I think it's likely that subtracting 1 or 2 from a large power never gives a power, though.
Apr 27, 2019 21:37
Something like 3^2^c^d^e might be harder to handle, though, since you end up having to check if c^d^e-1 is a power, and it might be large. (In which case it fits with 9^2^.)
Apr 27, 2019 21:34
@Anush I've thought a bit about that recently. Two towers cannot be equal unless their base numbers are powers of a common one. For that particular example that implies that the 2^5^ part is fixed, and that 2^5^3^2^4, 2^5^9^2^3 and 2^5^9^8^1 are the possible options.
Apr 19, 2019 09:39
Well it might be tricky to check if implementations actually solve the problem...
Apr 19, 2019 08:45
And then you know the former ends up larger, no matter what the rest of the bases are.
Apr 19, 2019 08:45
That does work with my observation, though. 4^5 = 1024 > 7*(3^2) + 3.
Apr 19, 2019 08:44
Yeah although not too bad with two steps
Apr 19, 2019 08:43
It's (3^4^5)*log 2 and (4^3^2)*log 5.
Apr 19, 2019 08:43
No.
Apr 19, 2019 08:42
Perhaps it's possible to check all a^b^c cases and verify none of them are closer than 7 times each other unless they're equal. If so that should give an algorithm.
Apr 19, 2019 08:39
And I don't know whether that can happen or not, and there's no obvious reason why it cannot.
Apr 19, 2019 08:38
It's not about being large. You can make it small. The problem is that it won't help if you end up having to compare two numbers that are so close you need more precision than you have memory.
 
May 1, 2019 14:28
I've warned those who had TIO links if they failed for the new test case.
May 1, 2019 14:28
Suggested test case: 2^3^12 == 8^3^11. Evil grin. This is smaller than I'd like, but I couldn't find a bigger one where floating point error matters.