Several StackExchange sites have support for mathematical formulae using MathJax (LaTeX syntax).
Many Code-Golf challenges are mathematical in nature. Equations come up very often in discussions.
Therefore, I think it would be very useful to enable support for this on here as well?
Test to see...
Here is many guestions tagged code-golf. Then code isn't usually commented and always "not human-readable". Now your mission is write The Ungolfer, program that ungolfs code.
It must be written in language that it ungolfs
It can ungolf code and comment it so good that even starting programmer c...
I was playing around with big numbers, and wrote the following code:
import time
def ispow2(n):
return not n & n - 1
start = time.clock()
ispow2(2**100000000)
end = time.clock()
print(end - start)
Surprisingly, this outputs 0.016864107385627148, and insanely short amount of time. Howeve...
@user2179021 A good popcon question still needs a reasonably clear goal (example 1, example 2). As it stands, the range of possible answers to your question extends from simple one-liners like CLS:PRINT"OK"all the way up to full-screen animations with stereo soundtracks. It's way too broad.
Bash + Coreutils (Linux and possibly Mac)
echo "The system is going down for maintenance NOW.
clear
sleep 5
dmesg|while read i; do echo $i; sleep 0.1; done
cat /etc/issue
login
@user2179021 Yes, but like I said, I won't, because 1. mod votes are binding, and I don't like to exercise that much power unless it's clearly egregious, and your post isn't; 2. I'm personally biased against popcons, but as a mod, I have to follow community consensus, so I'm not going to close a question just because it's a popcon unless, as a community, we decide to ban them.
Whereas, once we have a community consensus on code-trolling, I will enforce that with pleasure. :-)
import java.math.BigInteger;
public class Factorials {
public static BigInteger fac;
public static BigInteger two = BigInteger.valueOf(2);
static BigInteger mul(BigInteger start, BigInteger end) {
if(start == end) {
return start;
} else {
BigInteger mid = start.add(end.subtract(start).divide(Factorials.two));
return Factorials.mul(start, mid).multiply(Factorials.mul(mid, end));
}
}
public static void main(String[] args) {
And I found the top of the error:
Exception in thread "main" java.lang.StackOverflowError
at java.math.MutableBigInteger.divideKnuth(MutableBigInteger.java:1187)
at java.math.BigInteger.divideKnuth(BigInteger.java:2049)
at java.math.BigInteger.divide(BigInteger.java:2030)
at factorials.Factorials.mul(Factorials.java:15)
at factorials.Factorials.mul(Factorials.java:16)
at factorials.Factorials.mul(Factorials.java:16)
at factorials.Factorials.mul(Factorials.java:16)
at factorials.Factorials.mul(Factorials.java:16)
at factorials.Factorials.mul(Factorials.java:16)
@ChrisJester-Young Also, KoTHs. Seriously fun stuff.
@Trimsty Have you traced/logged start and end to see what's going on? That's where I'd start.
If you're working with sufficiently large numbers, though, you might not have infinite recursion anyway, just "too much". I don't know what range it's supposed to be working on, but you're branching to mul twice on each call.
I have seen several (2) new questions that are supposed to be copied, not written, from StackOverflow. From the original question:
Your mission is to make the most interesting program you can -- without ever writing a single line of code. You can only use code which is already written for you...
It is triggering then. Okay, you're doing a depth-first call. It goes all the way down the first branch until 0,0. That branch then ends. It goes up to the last call 0,1. The two paths it takes then are 0,0 and 0,1 (start,mid) and (mid,end). end is always 1 on the second call.
@durron597 Thanks! Too bad I get errors while compiling that. :P As at the bottom of the question, Recommendations for arbitrary-precision high-speed Java integer libraries? :P
bash-3.1$ make File not found - *.java wget -c -SN "ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/g cc-4.6.1/gcc-java-4.6.1.tar.bz2" 'wget' is not recognized as an internal or external command, operable program or batch file. make: *** [gcc-java-4.6.1.tar.bz2] Error 1
Idea: I'll write an API for the bot to interface with whatever ajax api i can conjure up (possibly stealing it from doorknob) (hey we can make a library!)
Time to be a jerk and ping @Doorknob? I only have 20 minutes left :c
@Rusher From what I saw in chat, he's operating on the assumption that there hasn't been sufficient community consensus about it yet, so the status quo holds. I wrote an answer on meta about this (among other things) earlier if you're interested. I agree that they should be allowed (and encouraged), and I'd like to see a consensus actually take hold.
Yea, I was trying to put something together for it with a custom function rather than class, but the answer you got beat mine out. I'm not much good with python, though.
@Rusher It was a bit shorter than the original method you were using (assuming more than 6-7 uses, it still lost out on 4), but quite a bit longer than using a class. I didn't see the point of posting it then.
I like this concept. I think it has the potential to spawn some really interesting new challenges. So let it thrive for now and see where this is going. I also agree with Quincunx that we can wait for another one or two questions before making this a tag. Maybe this remains a one-timer after all,...