text:
Compute every combination of operations written in a .TXT file
Your task is to create a program that computes every combination of the operations written in a .TXT file.
Example TXT File:
1
+
2
/
3

Example Output:
1+2/3=1
1+3/2=2
2+1/3=1
2+3/1=5
3+2/1=5
3+1/2=2
1/2+3= //See bonuses. If your program does not feature float, leave blank result.
1/3+2= //See above.
2/1+3=5
2/3+1= //See above.
3/2+1= //See above.
3/1+2=5

Specs:

Every line of the .TXT file must contain a number or an operation;
The minimum length for the .TXT file is 5 lines;
The operations must be computed from left to right. E.g. 4+4/2 results in 4;
Your program should feature +, -, * and / operations;
Your program should work with any valid input of any valid length.

Scoring:
Code length is your starting score, but not the only parameter. Here's a short list of bonuses you can achieve to lower your score. The user with the lowest score wins.

Implement ^: -20;
Implement log (in base e): -30;
Implement logn (where n is any positive base): -50 (only -20 if you achieved the log bonus);
Implement e (and the number in the line below is the exponent of 10. So 1e4=10000): -20;
Can handle negative values: -10;
Can handle float values: -20;
There are no digits (0123456789) in the code: -10;
There is no call to eval or equivalent: -20;
All of the above: -100.

For a total of -250 bonus points.
Good luck!

Why the The operations must be computed in order. E.g. 4+4/2 results 4; spec? This is against the rules of math!

I was using an old calculator when I had this idea. In old calculators you had to type a number, press the desired operation, then type another number then press the desired operation again, and so on. There were no parenthesis or rules. I tried to give this challenge this behavior (also, the .TXT file is - more or less - what those calculators printed on paper :) )

That was probably put there in order to generate all possible combinations. If you allow math precedence rules, then both 4/2+4 and 4+4/2 generate the same value, and that would be pointless.

@Tobia That is indeed a nice side-effect that convinced me to post this :P With larger inputs with lots of * this effect is even more appreciable, like in 42+42*3!

The requirement to compute operations in order also helps further enforce the avoidance of trivial solutions which would otherwise just concatenate the TXT file and evaluate the expression. (Although those would be at a +20 disadvantage against other solutions anyway.)

Closely related: http://codegolf.stackexchange.com/q/1328/194 , http://codegolf.stackexchange.com/q/6417/194 , http://codegolf.stackexchange.com/q/10790/194

Is the text file name a constant?  Or input?

@BenReich you decide, whichever shortens your code.

implementing ^ is extremely easy; it is just the XOR of two numbers! (If you meant power, please say so. Other people might get confused)

Rather than leaving lines blank, can we treat the numbers (like 1/2) as 0 (ie find the greatest int less than it and use that)?

@Quincunx I really didn't think about XOR. I guess it wouldn't be fair to change the question right now :( Same applies for your other question!

Mathematica (-4 = 246 - 250)
Update: operation e instead of the number representation with e.
Update2: reading from the file.
i = "1.txt";

w@"log"=r=Real;
e_~p~c_:=(g[x_r,w@c=c]~g~y_r:=#;p)&@e
y~Log~x~p[x+y,"+"][x-y,"-"][x/y,"/"][x*y,"*"][x*10^y,"e"][x^y,"^"]~"logn";
x_r~g~r:=Log@x
w@y_:=N@ToExpression@y
g[,x_]:=x
f@x_r:=s~Print~x
f@Fold[g,s=#<>"=";,w/@#]&/@Permutations@ReadList[i,String];

File:
1
+
2
/
3

Output:
1+2/3=1.
1+3/2=2.
1/2+3=3.5
1/3+2=2.33333
2+1/3=1.
2+3/1=5.
2/1+3=5.
2/3+1=1.66667
3+1/2=2.
3+2/1=5.
3/1+2=5.
3/2+1=2.5

File:
-1
^
2
e
3
logn
4
log

Output:
-1e2^4logn3log=2.81943
-1e2^4loglogn3=2.65196
-1e3^2logn4log=2.29916
-1e3^2loglogn4=1.89411
-1e3^4logn2log=3.68545
-1e3^4loglogn2=4.78822
-1e4^2logn3log=2.81943
-1e4^2loglogn3=2.65196
2^-1e3logn4log=1.50027
2^-1e3loglogn4=1.31783
2^-1e4logn3log=2.04804
2^-1e4loglogn3=1.94981
2^3logn4e-1log=-1.89712
2^3logn4loge-1=0.0405465
2^3loge-1logn4=-1.13287
2^3loglogn4e-1=0.0528098
2^4e-1logn3log=-0.849063
2^4e-1loglogn3=-0.687244
2^4logn3e-1log=-1.37685
2^4logn3loge-1=0.0925734
2^4loge-1logn3=-1.16766
2^4loglogn3e-1=0.0928245
2e-1logn3^4log=1.52735
2e-1log^4logn3=1.73268
2e3logn4^-1log=-1.70163
2e3logn4log^-1=0.587671
2e3log^-1logn4=-1.46309
2e3loglogn4^-1=0.683487
2e4logn3^-1log=-2.19884
2e4logn3log^-1=0.454785
2e4log^-1logn3=-2.08708
2e4loglogn3^-1=0.479139
2logn3^-1e4log=9.6709
2logn3^-1loge4=4605.61
2logn3^4e-1log=-4.14483
2logn3^4loge-1=-0.184224
2logn3e-1^4log=-11.0526
2logn3e-1log^4=58.2928
2logn3e4^-1log=-8.74978
2logn3e4log^-1=0.114289
2logn3log^-1e4=-21712.7
2logn3log^4e-1=0.00449933
2logn3loge-1^4=4.49933*10^-6
2logn3loge4^-1=-0.000217127
2logn4^-1e3log=7.6009
2logn4^-1loge3=693.147
2logn4^3e-1log=-4.38203
2logn4^3loge-1=-0.207944
2logn4e-1^3log=-8.9872
2logn4e-1log^3=-26.8849
2logn4e3^-1log=-6.21461
2logn4e3log^-1=0.160911
2logn4log^-1e3=-1442.7
2logn4log^3e-1=-0.0333025
2logn4loge-1^3=-0.000333025
2logn4loge3^-1=-0.0014427
2log^-1e3logn4=5.24728
2log^-1e4logn3=8.71723
2log^-1logn3e4=3336.14
2log^-1logn4e3=264.383
2log^3e-1logn4=-2.45411
2log^3logn4e-1=-0.079315
2log^4e-1logn3=-3.43036
2log^4logn3e-1=-0.133446
2loge-1^3logn4=-5.77604
2loge-1^4logn3=-9.71807
2loge-1logn3^4=34.8402
2loge-1logn4^3=-7.13719
2loge3^-1logn4=-4.71851
2loge3logn4^-1=0.211931
2loge4^-1logn3=-8.05
2loge4logn3^-1=0.124224
2loglogn3^-1e4=-29974.7
2loglogn3^4e-1=0.00123874
2loglogn3e-1^4=1.23874*10^-6
2loglogn3e4^-1=-0.000299747
2loglogn4^-1e3=-3782.39
2loglogn4^3e-1=-0.001848
2loglogn4e-1^3=-0.00001848
2loglogn4e3^-1=-0.00378239
3^-1e2logn4log=0.928001
3^-1e2loglogn4=0.905028
3^-1e4logn2log=2.45982
3^-1e4loglogn2=3.02001
3^2logn4e-1log=-1.84202
3^2logn4loge-1=0.0460561
3^2loge-1logn4=-1.09312
3^2loglogn4e-1=0.0567841
3^4e-1logn2log=1.10457
3^4e-1loglogn2=1.06479
3^4logn2e-1log=-0.45573
3^4logn2loge-1=0.184686
3^4loge-1logn2=-1.18625
3^4loglogn2e-1=0.213568
3e-1logn2^4log=2.20856
3e-1logn4^2log=-0.282015
3e-1log^2logn4=0.267803
3e-1log^4logn2=1.07121
3e2logn4^-1log=-1.4145
3e2logn4log^-1=0.706966
3e2log^-1logn4=-1.25596
3e2loglogn4^-1=0.796204
3e4logn2^-1log=-2.69953
3e4logn2log^-1=0.370435
3e4log^-1logn2=-3.36583
3e4loglogn2^-1=0.297104
3logn2^-1e4log=8.74978
3logn2^-1loge4=-4605.61
3logn2^4e-1log=-0.460342
3logn2^4loge-1=0.184224
3logn2e-1^4log=-7.3681
3logn2e-1log^4=11.5128
3logn2e4^-1log=-9.6709
3logn2e4log^-1=0.103403
3logn2log^-1e4=21712.7
3logn2log^4e-1=0.00449933
3logn2loge-1^4=4.49933*10^-6
3logn2loge4^-1=0.000217127
3logn4^-1e2log=4.83776
3logn4^-1loge2=23.2586
3logn4^2e-1log=-2.76776
3logn4^2loge-1=-0.0465173
3logn4e-1^2log=-5.07034
3logn4e-1log^2=6.42709
3logn4e2^-1log=-4.37258
3logn4e2log^-1=0.228698
3logn4log^-1e2=-429.948
3logn4log^2e-1=0.00540964
3logn4loge-1^2=0.000540964
3logn4loge2^-1=-0.0429948
3log^-1e2logn4=3.25409
3log^-1e4logn2=13.152
3log^-1logn2e4=-1356.82
3log^-1logn4e2=-6.78412
3log^2e-1logn4=-1.52528
3log^2logn4e-1=0.0135682
3log^4e-1logn2=-2.7792
3log^4logn2e-1=0.0542729
3loge-1^2logn4=-3.18625
3loge-1^4logn2=-12.745
3loge-1logn2^4=103.066
3loge-1logn4^2=2.53804
3loge2^-1logn4=-3.38977
3loge2logn4^-1=0.295005
3loge4^-1logn2=-13.4234
3loge4logn2^-1=0.0744968
3loglogn2^-1e4=73701.6
3loglogn2^4e-1=0.0000338917
3loglogn2e-1^4=3.38917*10^-8
3loglogn2e4^-1=0.000737016
3loglogn4^-1e2=1474.03
3loglogn4^2e-1=0.000460242
3loglogn4e-1^2=0.0000460242
3loglogn4e2^-1=0.147403
4^-1e2logn3log=1.07498
4^-1e2loglogn3=1.0641
4^-1e3logn2log=2.07516
4^-1e3loglogn2=2.46505
4^2e-1logn3log=-0.849063
4^2e-1loglogn3=-0.687244
4^2logn3e-1log=-1.37685
4^2logn3loge-1=0.0925734
4^2loge-1logn3=-1.16766
4^2loglogn3e-1=0.0928245
4^3e-1logn2log=0.985097
4^3e-1loglogn2=0.892428
4^3logn2e-1log=-0.510826
4^3logn2loge-1=0.179176
4^3loge-1logn2=-1.26573
4^3loglogn2e-1=0.20562
4e-1logn3^2log=-0.362939
4e-1log^2logn3=-0.159149
4e2logn3^-1log=-1.69629
4e2logn3log^-1=0.589523
4e2log^-1logn3=-1.62963
4e2loglogn3^-1=0.613635
4e3logn2^-1log=-2.48205
4e3logn2log^-1=0.402893
4e3log^-1logn2=-3.05208
4e3loglogn2^-1=0.327646
4logn2^-1e3log=6.21461
4logn2^-1loge3=-693.147
4logn2^3e-1log=-0.223144
4logn2^3loge-1=0.207944
4logn2e-1^3log=-4.82831
4logn2e-1log^3=-4.16891
4logn2e3^-1log=-7.6009
4logn2e3log^-1=0.131563
4logn2log^-1e3=1442.7
4logn2log^3e-1=0.0333025
4logn2loge-1^3=0.000333025
4logn2loge3^-1=0.0014427
4logn3^-1e2log=4.37258
4logn3^-1loge2=-23.2586
4logn3^2e-1log=-1.83741
4logn3^2loge-1=0.0465173
4logn3e-1^2log=-4.14
4logn3e-1log^2=4.28489
4logn3e2^-1log=-4.83776
4logn3e2log^-1=0.206707
4logn3log^-1e2=429.948
4logn3log^2e-1=0.00540964
4logn3loge-1^2=0.000540964
4logn3loge2^-1=0.0429948
4log^-1e2logn3=3.89449
4log^-1e3logn2=9.49455
4log^-1logn2e3=-471.234
4log^-1logn3e2=-29.7315
4log^2e-1logn3=-1.50127
4log^2logn3e-1=0.0594631
4log^3e-1logn2=-1.90823
4log^3logn2e-1=0.14137
4loge-1^2logn3=-3.59718
4loge-1^3logn2=-8.55208
4loge-1logn2^3=-23.1661
4loge-1logn3^2=3.23492
4loge2^-1logn3=-4.48912
4loge2logn3^-1=0.222761
4loge3^-1logn2=-10.437
4loge3logn2^-1=0.0958128
4loglogn2^-1e3=2122.09
4loglogn2^3e-1=0.0104643
4loglogn2e-1^3=0.000104643
4loglogn2e3^-1=0.00212209
4loglogn3^-1e2=336.343
4loglogn3^2e-1=0.00883964
4loglogn3e-1^2=0.000883964
4loglogn3e2^-1=0.0336343

Description:

The function w[y] converts string y to the number if y is not an operation.
The pattern g[g[x,c],y] is converted to x+y, x-y, etc depending on the operation c. Otherwise it stay a symbolic expression.
f[x] prints x only if it is a number.

That doesn't appear to read from the text file. So, this doesn't complete the challenge.

@Rees Updated. Thank you for pointing me out!

You are using ToExpression which is the equivalent of eval (and you may not be evaluating log, only logn, if I'm not mistaken.) Either way, I don't think you can claim the full -250 bonus.

@Tobia ToExpression is the sole documented way for converting a string with one number to a number. I don't use ability ToExpression to convert expressions. log take only one argument so it is implemented separately, see w@"log"=r=Real; and x_r~g~r:=Log@x lines. I think that I implemented all bonus tasks!

Fair then. Good job!

GolfScript 21 (51 characters -10 for handling negatives -20 for handling ^)
"#{File.read('a.txt')}"'^'/'?'*"\n"/(20@2/{(}%+''++~

Explanation:
Suppose a.txt contains "2+3/1*4" (separated by new lines).
"#{File.read('a.txt')}" # Read in 'a.txt' as a string
'^'/'?'* # Replace all '^' with '?' to handle exponent.  This works by splitting the string on '^' and then folding on '?'.
"\n"/ # Split on newlines, so that we have an array of characters
(20@ # Pull out the first element of the array, push a 20 (ASCII value for space) and rearrange stack

At this point, the stack will look like 2 20 '+3/1*4'.
2/ # Group by 2

So the stack looks like 2 20 [['+','3'],['/','1'],['*','4']].
{(}% # Map each element of the array to the tail of the tuple followed by its head.

So the stack looks like 2 20 [['3'], '+', ['1'], '/', ['4'], '*']
+''++ # Concatenate, stringify, and concatenate.  Note that adding '' to an array flattens it.

So we are left with '2 3 + 1 / 4 *'.
~ # Finally, evaluate the string, since we were left with valid GolfScript.

This works with negatives, but accomplishes none of the other bonuses.

this doesn't output all possible combinations, does it?

It doesn't seem to.

GolfScript, score 54 (104 characters, bonus for neg., ^, e)
n%[[]]\{n/`{`{^2$<\@^>++}+\:^,),/}+%}/.&{2/1\{0='+-*/^e'\?0<&}/},{?}:^;{10\?*}:e;{."="+[n]@+2/{~~\~}/n}/

The input is given on STDIN.
Example
For input 1 2 3 + e:
3+2e1=50
3e2+1=301
2+3e1=50
2e3+1=2001
2+1e3=3000
2e1+3=23
3+1e2=400
3e1+2=32
1+3e2=400
1e3+2=1002
1+2e3=3000
1e2+3=103

Commented code with basic building blocks
# split input
n%

# generate all permutations of the input (I'm working on a shorter implementation)
[[]]\{n/`{`{^2$<\@^>++}+\:^,),/}+%}/

# remove any duplicates (occur if same number/operator is given more than once)
.&

# filter for those permutations where each second element is an operator
{2/1\{0='+-*/^e'\?0<&}/},

# define operators ^ and e
{?}:^;
{10\?*}:e;

# Loop over all permutations
{
  .
  # make string representation
  "="+
  # reorder expression from ltr-infix into stack order and execute operations
  [n]@+2/{~~\~}/
  # add newline
  n
}/

Javascript, 338 characters
Handles e, negative values, and floats, bonus -50, score 288.
function g(a,p,r){a.length<1?r.push(p):a.map(function(c){g(a.filter(function(x){return x!=c}),p.concat(c),r)})}
x=[];y=[];x.push(readline());while(n=readline()){x.push(readline());y.push(n)}k=[];l=[];g(x,[],k);g(y,[],l);
l.map(function(y){k.map(function(x){r=x[0];s=r;y.map(function(b,i){n=b+x[i+1];s=s+n;r=eval(r+n);});print(s+'='+r)})})

Example here.

Ruby 177 characters

Implemented ^: -20
Handles negative values: -10
No eval: -20

Total: 127
$<.map{|x|x=~/\d+/&&x.to_i||x.chomp}.permutation{|x|$_=x*'';a,*b=x;puts$_+"=#{b.each_slice(2).reduce(a){|m,(o,y)|[m+y,m-y,m*y,m/y,m**y]["+-*/^".index o]}}"if~/^-?\d+(\W-?\d+)*$/}

Run with the input file as command line argument or give input on stdin.
Chopped up for readability:
$<.map{|x|x=~/\d+/?x.to_i: x.chomp}
  .permutation{|x|
    $_=x*''
    a,*b=x
    puts $_+"=#{
      b.each_slice(2).reduce(a){|m,(o,y)|[m+y,m-y,m*y,m/y,m**y]["+-*/^".index o]}
    }" if ~/^-?\d+(\W-?\d+)*$/}

APL, score 36
156 chars - 20 (^) - 50 (logn) - 20 (e) - 10 (negative) - 20 (float) = 36
{⍺←{⍵[{1≥⍴⍵:⊃,↓⍵⋄⊃⍪/⍵,∘∇¨⍵∘~¨⍵}⍳⍴⍵]}⋄e←{⍺×10*⍵}⋄⍪,(↓⍺v/⍨~d)∘.{(,⍵,⍪⍺,'='),{⍎⍕⍵,⍺}/⌽(⍎↑⍵),↓'+-×÷*⍟e'['+-*/^le'⍳∊1⌷¨⍺],⍪1↓⍵}↓⍺v/⍨d←2|⍳⍴v←('\S+'⎕S'&')⍵⎕ntie 0}

Without any instructions to the contrary, I made logn an infix operator, as you would type it on a calculator, so that log2(16) is 2 logn 16.
Source
⍝ main function; ⍵ is the file to read
{
    p←{1≥⍴⍵:⊃,↓⍵⋄⊃⍪/⍵,∘∇¨⍵∘~¨⍵}   ⍝ permutation matrix (taken from "dfns")
    q←{⍵[p⍳⍴⍵]}                   ⍝ all permutations of the given vector
    e←{⍺×10*⍵}                    ⍝ 'e' function as required
    v←('\S+'⎕S'&')⍵⎕ntie 0        ⍝ read input file and split on spaces
    d←2|⍳⍴v                       ⍝ bitmap of odd indices of input vector
    n←v/⍨d                        ⍝ odd-index values: the numbers
    o←v/⍨~d                       ⍝ even-index values: the operators

    ⍝ f will be called for each permutation of operators and numbers;
    ⍝ ⍺ is the (shuffled) list of operators; ⍵ of numbers
    f←{
        ⍝ translate the operators into APL
        ⍝ a trick is used to recognize 'logn' by its first letter only
        t←'+-×÷*⍟e'['+-*/^le'⍳∊1⌷¨⍺]

        ⍝ prepare the list of operations to perform, in reverse order,
        ⍝ followed by a single scalar with the value of the first number
        m←⌽(⍎↑⍵),↓t,⍪1↓⍵

        ⍝ fold over the previous vector, executing every operation in order
        r←{⍎⍕⍵,⍺}/m

        ⍝ return the result, preceded by a representation of the operation
        (,⍵,⍪⍺,'='),r
    }
    ⍝ generate all permutations of operators and of numbers; call f on
    ⍝ every combination (outer product); ravel and tabulate the result
    ⍪,(↓q o)∘.f↓q n
}

Examples
Input file:
-2.5
/
3
^
4

Output:
      {paste golfed code here} 'a.txt'
-2.5  /  3  ^  4 = 0.4822530863
-2.5  /  4  ^  3 = ¯0.244140625
3  /  -2.5  ^  4 = 2.0736
3  /  4  ^  -2.5 = 2.052800957
4  /  -2.5  ^  3 = ¯4.096
4  /  3  ^  -2.5 = 0.4871392899
-2.5  ^  3  /  4 = ¯3.90625
-2.5  ^  4  /  3 = 13.02083333
3  ^  -2.5  /  4 = 0.01603750748
3  ^  4  /  -2.5 = ¯32.4
4  ^  -2.5  /  3 = 0.01041666667
4  ^  3  /  -2.5 = ¯25.6

Input file:
2.5
e
3
logn
4

Output:
      {paste golfed code here} 'b.txt'
2.5  e  3  logn  4 = 0.1771838201
2.5  e  4  logn  3 = 0.1084874404
3  e  2.5  logn  4 = 0.2022289117
3  e  4  logn  2.5 = 0.08888300898
4  e  2.5  logn  3 = 0.1538078748
4  e  3  logn  2.5 = 0.1104756749
2.5  logn  3  e  4 = 11989.77847
2.5  logn  4  e  3 = 1512.941595
3  logn  2.5  e  4 = 8340.437671
3  logn  4  e  2.5 = 399.0350129
4  logn  2.5  e  3 = 660.9640474
4  logn  3  e  2.5 = 250.6045754


text:
Write the longest program that prints the date of tomorrow
I would like to propose a new kind of challenge: Anti Code Golf! (as anti-golf, not anti-code). The idea is to write the longest program you can write to do something.
That would be Code Bowling, as pointed out by ProgramFOX.
Rules

No ridiculously unnecessary whitespace (e.g. 3 lines between each statement, etc. indentation is OK, just don't overuse).
Score is awarded by number of bytes used to work * (in source code, input data or output data) memory usage doesn't count.
Highest score wins. In the event of a tie, most upvoted wins. In the event of a voting tie a randomly chosen answer wins.
You may not read from a external resource, such as a file or web service, except (when possible) the program's own source code and/or a file/service provided by the program itself.
The program must run in a reasonable time (< 5 minutes) except where otherwise specified.

.* Comments do not count for length.

Now, onto the challenge itself:

Write a program that prints the full date of tomorrow to stdout (or equivalent) in ASCII encoding. It may or not receive any arguments, but the current date must not be input directly by the user.

That's called a "Code Bowling", not a "Anti Code Golf". Such challenges already exist. I updated your question. Also, an important hint: forbid comments and network access.

Sorry for that, should have searched more thoroughly first. Good idea about network access and comments

I'm a bit confused: a program that starts with "int a=1, b=2, c=3,..... " up to 1.000.000 counts as millions of bytes?

No, it would be the amount of characters needed to write such program.
bytes used = (size of source code) + (size of arguments read) + (size of stdin read) + (size of stdout) + (size of stderr)
I hope this clears the idea a bit more. Every non-memory byte you use is counted

I never really got the meaning of [tag:code-bowling]. For example solution like this is allowed or not? http://pastebin.com/Km0tD0v0

It's sketchy, but the rules don't specifically disallow it. I (and all code-bowling askers and readers) expect creative usage of language features and exaggeration without obvious repetition. Otherwise, what's the point of answering? Of course, you "win" but everyone will just look at your answer briefly and say "meh, another every-literal-possible answer", instead of "wow, that's what I call layered code!" (or whatever, just exampling) and have a good laugh.

I’m voting to close this question because code bowling requires an additional objective validity criterion in order to make sense as a scoring criterion.

C# - ~500Kb -
Don't you love nested if's?
Used to work only for 2014 dates, but successfully refactored to work for any date :)
Cannot post code here, I just receive an error...
http://pastebin.com/azGr3JSz
(Will probably hang your browser, sorry)

Damn it, you crashed my browser. I guess that means you win :P

I like how the final else to make it "work for any date" is the only useful part of the code :-).

Well, your answer may be easily improved, but I think you should post a code which generated your answer, or maybe you wrote everything yourself? :D

Can't find the generating code, sorry :(

JavaScript, 2015 chars (all reasonably useful)
I believe this is in the spirit of the question. ;)
Based on one of my previous answers
// we all know that OOP == good
function TomorrowManager() {
    // constants == good too
    this.values = {
        ERROR: 1, // value on error
        UNINITIALIZED:  2, // value when not initialized yet
        OK: 0 // desired value
    }
    this.consts = {
        HOURS_IN_DAY: 24,
        MINUTES_IN_HOUR: 60,
        SECONDS_IN_MINUTE: 60,
        MILLISECONDS_IN_SECOND: 1000
    }
    this.value = this.values.UNINITIALIZED
}
TomorrowManager.prototype.setValue = function(num) {
    if (typeof num !== 'number') throw new Error('cannot set value to non-number')
    if (!this.value) this.value = this.values.ERROR // oh noes
    else this.value = num
}
// initialize the value
TomorrowManager.prototype.initialize = function() {
    this.setValue(this.values.OK) // set the value to ONE
    return true // return true for success
}
// get the value
TomorrowManager.prototype.getValue = function() {
    if (this.value == this.values.ERROR) { // if the value is ERROR
        throw new Error('value not initialized')
    } else return this.value // return the value
}
TomorrowManager.prototype.getTomorrow = function() {
    return new Date(new Date().getTime() + this.consts.HOURS_IN_DAY * this.consts.MINUTES_IN_HOUR * this.consts.SECONDS_IN_MINUTE * this.consts.MILLISECONDS_IN_SECOND)
}

function TomorrowManagerFactory() {}
TomorrowManagerFactory.prototype.getTomorrowManager = function() {
    return new TomorrowManager()
}

function getTomorrow() {
    var m = new TomorrowManagerFactory().getTomorrowManager() // make a TomorrowManager
    var success = m.initialize() // initialize the value
    if (success) {
        if (m.getValue() === m.values.OK) {
            return m.getTomorrow()
        } else {
            throw new Error('bad value')
        }
    }
    else {
        // there was an error in the initialization
        var retVal = m.values.ERROR // we will return an error
        delete m // maybe it's corrupted
        throw new Error('corrupted TomorrowManager')
        return retVal // return an error in case the throw didn't work
    }
}

alert(getTomorrow())

Seems awesome! But I must say, OOP instanceof Good.
Exactly the kind of answer expected, very long and verbose, yet without random code not related to the functionality.

Putting the "Java" in JavaScript.

Lua - 7159
-- Let's begin by implementing OOP
-- Lua does not have OOP but it has the tools to implement it

local class = {}

function class:inherit()
    local class = {}
    class.class = class
    class.__index = self
    class.ancestor = self
    return setmetatable(class, class)
end
function class:new(initializer)
    local object = initializer or {}
    object.__index = self
    setmetatable(object, object)
    if self.__init  then
        self.__init(object)
    end
    return object
end
function class:super(meth, ...)
    local ancestor = self.ancestor
    local class = self.class
    local __index = self.__index
    self.__index = class.ancestor
    self.class = class.ancestor
    self.ancestor = class.ancestor.ancestor
    return (function(...)
        self.ancestor = ancestor
        self.class = class
        self.__index = __index
        return ...
    end)(self[meth](self, ...))
end

-- Now let's create a few classes used for counting

local counter = class:inherit()
counter.value = 1
function counter:setValue(value)
    self.value = value
end
function counter:getValue()
    return self.value
end
function counter:increment()
    self:setValue(self:getValue() + 1)
end

local boundedCounter = counter:inherit()
counter.maxbound = 1
counter.minbound = 1
function boundedCounter:setMaxbound(value)
    self.maxbound = value
end
function boundedCounter:getMaxbound()
    return self.maxbound
end
function boundedCounter:setMinbound(value)
    self.minbound = value
end
function boundedCounter:getMinbound()
    return self.minbound
end
function boundedCounter:increment()
    self:super"increment"
    if self:getValue() > self:getMaxbound() then
        self:setValue(self:getMinbound())
    end
end

local signalingBoundedCounter = boundedCounter:inherit()
counter.signal = function() end
function signalingBoundedCounter:setSignal(value)
    self.signal = value
end
function signalingBoundedCounter:getSignal()
    return self.signal
end
function signalingBoundedCounter:setUservalue(value)
    self.uservalue = value
end
function signalingBoundedCounter:getUservalue()
    return self.uservalue
end
function signalingBoundedCounter:increment()
    self:super"increment"
    if self:getValue() == 0 then
        self:getSignal()(self:getUservalue())
    end
end

-- Other miscelaneous classes we will need

local formatStringBuilder = class:inherit()
formatStringBuilder.string = ""
function formatStringBuilder:appendString(string)
    self.string = self.string .. string:gsub("%%", "%%%%")
end
function formatStringBuilder:appendFormat(specifier, length, decimals)
    length = tonumber(length)
    decimals = tonumber(decimals)
    specifier = tostring(specifier)
    local format = "%"
    if length then
        if length < 0 then
            format = format .. "0" .. -length
        else
            format = format .. length
        end
    end
    if decimals then
        format = format .. "." .. decimals
    end
    format = format .. specifier
    self.string = self.string .. format
end

function formatStringBuilder:getString()
    return self.string
end
function formatStringBuilder:format(...)
    return self.string:format(...)
end

local applicationFunction = class:inherit()
function applicationFunction:__call()
    return self.callback(unpack(self.arguments))
end
function applicationFunction:__init()
    self.__call = self.__call -- DO NOT REMOVE OR IT WILL NOT WORK
end

local case = class:inherit()
function case:__init()
    self.cases = {}
    self.handlers = {}
end
function case:addCase(case, handler)
    self.cases[#self.cases + 1] = case
    self.handlers[#self.handlers + 1] = handler
end
function case:execute(value)
    for iterator, case in ipairs(self.cases) do
        if case == value then
            self.handlers[case]()
            break
        end
    end
end

-- The main code:

local yearsFormat = formatStringBuilder:new()
yearsFormat:appendFormat"Y"
local monthsFormat = formatStringBuilder:new()
monthsFormat:appendFormat"m"
local daysFormat = formatStringBuilder:new()
daysFormat:appendFormat"d"
local todaysYear = tonumber(os.date(yearsFormat:getString()))
local todaysMonth = tonumber(os.date(monthsFormat:getString()))
local todaysDay = tonumber(os.date(daysFormat:getString()))

-- Let's store the year as a four-digit number

local thousandsOfYearsCounter = counter:new()
thousandsOfYearsCounter:setValue(0)
local hundredsOfYearsCounter = signalingBoundedCounter:new()
hundredsOfYearsCounter:setMaxbound(9)
hundredsOfYearsCounter:setMinbound(0)
hundredsOfYearsCounter:setValue(0)
hundredsOfYearsCounter:setSignal(thousandsOfYearsCounter.increment)
hundredsOfYearsCounter:setUservalue(thousandsOfYearsCounter)
local tensOfYearsCounter = signalingBoundedCounter:new()
tensOfYearsCounter:setMaxbound(9)
tensOfYearsCounter:setMinbound(0)
tensOfYearsCounter:setValue(0)
tensOfYearsCounter:setSignal(hundredsOfYearsCounter.increment)
tensOfYearsCounter:setUservalue(hundredsOfYearsCounter)
local yearsCounter = signalingBoundedCounter:new()
yearsCounter:setMaxbound(9)
yearsCounter:setMinbound(0)
yearsCounter:setValue(0)
yearsCounter:setSignal(tensOfYearsCounter.increment)
yearsCounter:setUservalue(tensOfYearsCounter)

for interator = 1, todaysYear do
    yearsCounter:increment()
end

local monthsCounter = signalingBoundedCounter:new()
monthsCounter:setMaxbound(12)
monthsCounter:setMinbound(1)
monthsCounter:setValue(0)
monthsCounter:setSignal(yearsCounter.increment)
monthsCounter:setUservalue(yearsCounter)

for interator = 1, todaysMonth do
    monthsCounter:increment()
end

local daysCounter = signalingBoundedCounter:new()

-- Depending on the months, there's different amount of days

local monthDaysCase = case:new()
monthDaysCase:addCase(1, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 31}})
monthDaysCase:addCase(2, function()
    if todaysYear % 4 == 0 then
        if todaysYear % 100 == 0 then
            if todaysYear % 400 == 0 then
                daysCounter:setMaxbound(29)
            else
                daysCounter:setMaxbound(28)
            end
        else
            daysCounter:setMaxbound(29)
        end
    else
        daysCounter:setMaxbound(28)
    end
end)
monthDaysCase:addCase(3, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 31}})
monthDaysCase:addCase(4, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 30}})
monthDaysCase:addCase(5, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 31}})
monthDaysCase:addCase(6, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 30}})
monthDaysCase:addCase(7, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 31}})
monthDaysCase:addCase(8, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 31}})
monthDaysCase:addCase(9, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 30}})
monthDaysCase:addCase(10, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 31}})
monthDaysCase:addCase(11, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 30}})
monthDaysCase:addCase(12, applicationFunction:new{callback = daysCounter.setMaxbound, arguments = {daysCounter, 31}})
monthDaysCase:execute(todaysMonth)

daysCounter:setMinbound(1)
daysCounter:setValue(0)
daysCounter:setSignal(monthsCounter.increment)
daysCounter:setUservalue(monthsCounter)

for interator = 1, todaysDay do
    daysCounter:increment()
end

daysCounter:increment()

local tomorrowsYear = thousandsOfYearsCounter:getValue() * 1000 + hundredsOfYearsCounter:getValue() * 100 + tensOfYearsCounter:getValue() * 10 + yearsCounter:getValue()
local tomorrowsMonth = monthsCounter:getValue()
local tomorrowsDay = daysCounter:getValue()

local dateFormat = formatStringBuilder:new()
dateFormat:appendFormat"d"
dateFormat:appendString"/"
dateFormat:appendFormat("d", -2)
dateFormat:appendString"/"
dateFormat:appendFormat("d", -2)
local tomorrowsDateString = dateFormat:format(tomorrowsYear, tomorrowsMonth, tomorrowsDay)
print(tomorrowsDateString)

Scoring: perl -pe 's/--.*\n//g;s/\s/ /mg;s/  */ /g;s/(\W) (\S)/$1$2/g;s/(\S) (\W)/$1$2/g;' < nextday.lua|wc -c (basically remove all whitespace that can be removed)
Also do not remove the DO NOT REMOVE marked line, it really will not work

I don't know Lua but the line that essentially looks to me like 1=1 --DO NOT REMOVE OR IT WILL NOT WORK made me laugh, +1.

@FGreg Roughly speaking it has an overridden field access operation, which tells it to fallback on the class table. What this does is get the value of self.__call using the overridden operation (i.e basically fetches it from the class table), and then sets it as a field in object table.

C#: 33,053 characters
I had to post the code on Pastebin because it was too long to post here in an answer:
http://pastebin.com/SwwB30Jy
How it works: the byte array actually contains the following code:
using System;namespace GetDateOfTomorrow{public static class Tomorrow{public static string GetDateOfTomorrow(){ return DateTime.Today.AddDays(1).ToShortDateString();}}}

Then, you compile that code to a new assembly and execute the GetDateOfTomorrow() method.

Mathematica 958
The following returns tomorrow's date, including the day of week.
date = "Date";
command1 = ToExpression[date <> ToString[Head["Calendar"]]]
ClearAll[a, b, c, d]
TreeForm[a + b^2 + c^3 + d]
command2 = ToExpression[date <> ToString[Part[%, 0]]]
months = {"January", "February", "March", "April", "May", "June",
  "July", "August", "September", "October", "November", "December"}
command3 = ToExpression[date <> ToString[Head[months]]]
daysOfTheWeek = {"Sunday", "Monday", "Tuesday", "Wednesday",
  "Thursday", "Friday", "Saturday"}
days = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
    19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
command4 =
 ToExpression[
  StringJoin[
   Take[Characters[
      Part[daysOfTheWeek[[RandomInteger[{1, 7}]]]]], -3] /. {char1_,
      char2_, char3_} :>
     StringJoin["", {ToUpperCase[char1], char2, char3}],
   ToString[Head[days]]]]
AstrologicalSigns = {"Aries", "Taurus", "Gemini", "Cancer", "Leo",
  "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius",
   "Pisces"}

Testing
command1[command2[command3[TimeZone -> $TimeZone],
  Fibonacci[7] - Length[AstrologicalSigns]], {"DayName", ", ",
  "MonthName", " ", "Day", ", ", "Year"}]

"Wednesday, January 15, 2014"

JAVA (2910 4406 characters)
import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Date;

public class Tomorrow {

    private static class DayOfMonth {

        private int value;

        public DayOfMonth(int value) {
            this.value = value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }

        @Override
        public String toString() {
            return Integer.toString(value);
        }

    }

    private static class MonthOfYear {

        private int value;

        public MonthOfYear(int value) {
            this.value = value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }

        @Override
        public String toString() {
            return new DateFormatSymbols().getMonths()[this.getValue()];
        }

    }

    private static class YearOfEverything {

        private int value;

        public YearOfEverything(int value) {
            this.value = value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }

        @Override
        public String toString() {
            return new StringBuilder("").append(Math.abs(value)).append(' ').append((value < 0) ? "BCE" : (value == 0) ? "" : "CE").toString();
        }

    }

    private static class DateManager {

        private DayOfMonth day;
        private MonthOfYear month;
        private YearOfEverything year;

        public DateManager() {
            this.day = null;
            this.month = null;
            this.year = null;
        }

        public void setDayOfMonth(int day) {
            this.day = new DayOfMonth(day);
        }

        public void setMonthOfYear(int month) {
            this.month = new MonthOfYear(month);
        }

        public void setYearOfEverything(int year) {
            this.year = new YearOfEverything(year);
        }

        public DayOfMonth getDayOfMonth() {
            return day;
        }

        public MonthOfYear getMonthOfYear() {
            return month;
        }

        public YearOfEverything getYearOfEverything() {
            return year;
        }

        @Override
        public String toString() {
            return new StringBuilder("").append(this.getMonthOfYear().toString()).append(' ').append(this.getDayOfMonth().toString()).append(", ").
                       append(this.getYearOfEverything().toString()).toString();
        }

    }

    public static final int MONTHS_PER_YEAR = 12;

    public static boolean isLeapYear(YearOfEverything year) {
        int yearNum = year.getValue();
        if ((yearNum % 4 == 0) && (yearNum % 100 != 0))
            return true;
        else if (yearNum % 400 == 0)
            return true;
        else
            return false;
    }

    public static int getDaysInMonth(MonthOfYear month, YearOfEverything year) {
        if (month.getValue() == 1) {
            if (isLeapYear(year))
                return 29;
            else
                return 28;
        } else if ((month.getValue() == 3) || (month.getValue() == 5) || (month.getValue() == 8) || (month.getValue() == 10)) {
            return 30;
        } else {
            return 31;
        }
    }

    public static void main(String[] args) {

        DateManager manager = new DateManager();
        Calendar calendar = Calendar.getInstance();
        manager.setDayOfMonth(calendar.get(Calendar.DATE));
        manager.setMonthOfYear(calendar.get(Calendar.MONTH));
        manager.setYearOfEverything(calendar.get(Calendar.YEAR));

        manager.getDayOfMonth().setValue(manager.getDayOfMonth().getValue() + 1);
        if (manager.getDayOfMonth().getValue() > getDaysInMonth(manager.getMonthOfYear(), manager.getYearOfEverything())) {
            manager.setDayOfMonth(1);
            manager.getMonthOfYear().setValue(manager.getMonthOfYear().getValue() + 1);
            if (manager.getMonthOfYear().getValue() >= MONTHS_PER_YEAR) {
                manager.setMonthOfYear(1);
                manager.getYearOfEverything().setValue(manager.getYearOfEverything().getValue() + 1);
            }
        }

        System.out.println(manager.toString());

    }

}

Whitespace should be counted too.

Please use Markdown for formatting instead of HTML. A large part of your code was not displayed due to < operator: in Markdown code block they get transformed into HTML character entities automatically, but in HTML <pre> block you have to take care of them.

Sorry about that. Just found it easier than indenting each line, I suppose. I'll keep that in mind. And I fixed the count. Thanks, @Kroltan, for letting me know.

You not have to indent each line manually. Select the code block then either press Ctrl-K or click the “{}” button in the answer form's toolbar.

Hippopotomonstrosesquipedalian 2, ~66.6MB
Code (Your browser WILL hang)
Compiler

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Regex - Match half of the strings
Okay, the challenge is that you have to write a regex that matches half of all strings.
Some rules to clarify:
For ANY string length(>0), if I permute all strings(of that length), exactly half of them should be matched. Put more lightly, if I generate a random string of that length it should have a 50% chance of being matched. (this means that you cannot just match all even-length strings)
You may assume that strings contain only A-Z, a-z, and 0-9.
0 length strings are undefined, you can choose to either match them or not.
Shortest regex wins.

/^[A-Z0-4]*$/ works, doesn't it?

@TimSeguine No, if strings could have only uppercase, or only lower case it would. But since most strings have a combination of both, that misses most strings

/^[\w0-4]/ works, doesn't it?

oh yeah sorry, it works for one character but gets worse and worse after that. If i remove the star and the $ though, it should work. It takes then half of all one character strings and all of the other strings that start with one of those characters.

@JanDvorak I don't see how. Can you explain?

@Cruncher the same as above. If it starts with lowercase or a low digit, match. Otherwise, don't.

@JanDvorak but doesn't \w match all word characters?

@TimSeguine if it's case insensitive, then A-Z it is.

@JanDvorak The problem doesn't say anything about case insensitivity

@TimSeguine I mean, if \w matches both lowercase and uppercase

@JanDvorak I know, that is exactly my point. You are matching too many one character strings. There are 62, and you match 57 of them. It does it that way in PCRE at least IIRC. Is there a dialect in which it doesn't? If there is, then I concede defeat.

@JanDvorak Please don't say that \W matches uppercase letters.

6
/^[5-Z]/

In ASCII's order, there's 0-9 then A-Z then a-z
So Half of the string begin with 5-Z, the other half doesn't.

Dang, my answer is a duplicate of this...

But thanks for posting it, it made me realize that the good answer didn't necessarily include half of the letters and half of the numbers. any 31-char subset of A-Za-z0-9 is fine

@xem you are already making me regret changing my display name to my real name. :P

Oh god it's a real name? I'm sorry Tim. No more jokes. God bless you. I hope one day you'll forgive me. ='(

@xem when I see you in hell ;)

And say hello to your goat for me. http://histoires-d-ailleurs.over-blog.com/mr-seguin-s-goat-another-wolf-story

@xem haha, you are the second person to ever mention that to me.

9 characters (not counting leaning toothpicks)
Modified mine from the comments:
 /^[A-Z0-4]/

It will match half of all 1 character strings. Every string of length greater than one starts with a one character string, half of which will match. So half match in total.

+1 for leaning toothpicks if I could (but that would be +2)

6
/^[0-U]/

Ranges work for ascii values, so this matches half of the 62 combinations of first letters. Can match the empty string for one extra char:
/^[0-U]?/

For more confusion, this is also a solution:
/^[--U]/

Also this:
/^[-U]/

where the ascii 0 is right before the -.

/^[-U]/ is this considered 5 chars? Or still 6, just that one isn't printable?

@Cruncher One was unprintable. Otherwise, that would only match the characters - and U.

24
You didn't ask for a max length.
So an infinity of strings can exist.
Half of infinity = infinity.
But that doesn't lead anywhere.
Anyway, I'd say that "half of this infinite number of strings" start with [A-Z0-4] and the other half with [a-z5-9]
That's why I consider this answer correct (inspired by Tim Seguine)
/^[A-Z0-4][A-Za-z0-9]*$/

My name is Tim by the way. ;)

I did say that you need half of them for every length. That being said, this is a correct solution. It's just the end of it is redundant.

But your regex isn't the shortest one by any means. Even if string anchors are required, not matching non-alphanumeric words isn't.

Sorry for the typo Tam Seguine.

By your logic, all that is needed is /^[A-Z0-4]/, but that is Tim's solution...

No because /^[A-Z0-4]/ accepts strings that end with things other than A-Za-z0-9. I thought it wasn't allowed.

@xem I didn't say that it had to only match those strings, I said that you can assume that ALL strings have this form (or in other words, strings not of this form can have undefined behaviour)

So Tum Seguine's answer is the good one :) okay.

It's okay, this answer is also Tem approved

Your arguing about infinity, by the way, would be right, except the OP specified half of the strings of each length.

I was just joking about infinity/2 Tym ;)

@xem oh we are already moving into the semivowels? Next will be Twm I guess.

@TimSeguine already moving into the semivowel(no s). We can all just call you Mr. T

@Cruncher don't want to go off on a tangent, but are you implying there is only one semivowel?

@TimSeguine in English

@Cruncher Don't want to argue really, but there are actually plenty of uses of w in English as a semivowel

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Let's draw the flag of Nepal
Nepal’s flag (Wikipedia, Numberphile) looks very different from any other. It also has specific drawing instructions (included in the Wikipedia article). I want you guys to make a program which will draw the flag of Nepal.
The user inputs the requested height of the flag (from 100 to 10000 pixels) and the program outputs the flag of Nepal. You can choose any way to draw the flag: everything from ASCII art to OpenGL.
This is a popularity contest, so the winner will be the highest voted answer on the 1st of February, so don’t worry about length of code, but remember that shorter code may get more up-votes.
There is only one requirement: you are not allowed to use web resources.
Have fun :)

Deja vu! Also, how many rows of ASCII text are in 100px?

@KendallFrey Well, ASCII art is one of the ways, to solve this, however there is no answer into your question. as it depends on font size and spacing between lines, answer provider should count it himself.

In that case, surely print("|\\\n|\\") is a valid solution. I think you need to be more specific about the rules for non-bitmap entries.

User inputs height of flag that means that generated output if input is 100 and output of 101 should differ, so answer should contain something like GetTextExtentPoint32 to measure output

Please do not delete and repost your question. There's editing for a reason... also, there's no link in your new question.

@ST3 For ascii output, I recommend saying that each character is a pixel. It makes a lot of sense.

Also, rather than disallowing internet resources, why not require that the flag actually be drawn (ie created by code)?

I got a filling there is language that makes it pretty straightforward to code those drawing instructions. ContextFree first comes to mind. Looking forward to it.

what about a data: url? =p

SVG, 1375, 1262, 1036, 999, 943, 939
<svg>
<defs>
<style>.w{fill:white}</style>
<g id="f"><path d="M1,1L1,20L18,20L6,10L17,10z" style="stroke:#003893;fill:#dc143c"/></g>
<g id="m"><polygon points="1,0 -.5,.86 -.5,-.86"/></g>
<g id="b"><polygon points="1,0 -.5,.86 -.5,-.86"/><polygon points="1,0 -.5,.86 -.5,-.86"transform="rotate(32)"/></g>
<g id="t"><use xlink:href="#b"/><use xlink:href="#b"transform="rotate(60)"/></g>
<g id="s">
<use xlink:href="#m"/>
<use xlink:href="#m"transform="rotate(20)"/>
<use xlink:href="#m"transform="rotate(45)"/>
<use xlink:href="#m"transform="rotate(70)"/>
<use xlink:href="#m"transform="rotate(90)"/>
</g>
</defs>
<g transform="scale(.7)">
<use xlink:href="#f" x="5" y="6"transform="scale(19,23)"/>
<use xlink:href="#t" x="2.8" y="7"class="w"transform="scale(70)"/>
<path d="M157,292 A 40,35 0 1 0 237,292 43,45 0 1 1 157,292z"class="w"/>
<use xlink:href="#s" x="5.6" y="8.9"class="w"transform="scale(35)"/>
</g>
</svg>

SVG doesn't really have user input, AFAIK, so you can change the scale modifying this line:

<g transform="scale(.7)">

There should be exactly 8 triangles in the Moon and 12 in the Sun. But you got 11 and 15.

should be fixed.

It does have user input. By pressing CTRL + + or CTRL + - the user can change the scale in many web browsers.

This is 918 bytes long (you can use Unix line endings instead of Windows to save a byte per line break). And while we're at that topic, you can just drop line breaks altogether to bring it to 897. But this doesn't render at all in either IE, Chrome, Firefox or Inkscape for me. At least not as a standalone SVG. Only when embedded in HTML (but that brings it to 960 bytes). Fixing the XML errors brings the file to 1008 bytes. I'll golf it down a bit.

http://hypftier.de/temp/svg.7z is a Mercurial repository with the changes I made. You can inspect the messages easiest with hg log --style=changelog -r 0..tip. I might do a more detailed writeup of the techniques I used there.

JavaScript, 569 537 495 442 characters (ASCII)
h="";M=Math;Z=M.max;Y=M.min;function d(a,b,r,s,t){n=M.sqrt(a*a+e*e);return n-(r+M.abs((M.atan2(a,e
)/M.PI*b+t)%1-0.5)*s*n)}f=parseInt(prompt(),10);for(g=0;g<f;g++){for(k=0;k<2*f;k++)e=k/(0.5*f)-0.8
,q=g/(0.25*f),u=q-1.08,v=q-1.29,z=e*e+u*u-0.3364,E=Z(-e-0.8,Y(Z(0.62*e+0.8-q,-2.06+q),Z(1*e+0.8+
0.85-q,-3.87+q))),p=0>Y(d(q-2.91,6,0.38,0.7,10),Y(Z(e*e+v*v-0.3025,-z),Z(d(q-1.54,8,0.25,0.6,10.5)
,q-1.7)))?" ":-0.13>E?";":0>=E?"8":"",h+=p;h+="\n"}h

To run : copy-paste to browser console (eg: Chrome developer tools or Firebug)
Result :
8
8888
8888888
8888;88888
8888;;;;88888
8888;;;;;;;888888
8888;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;;;;;;;888888
8888;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;; ;  ;  ; ;;;;;;;;;;;;;;;;;;;;;;88888
8888;;; ;;;;;               ;;;;; ;;;;;;;;;;;;;;;;88888
8888;;;  ;;;;;;           ;;;;;;  ;;;;;;;;;;;;;;;;;;;888888
8888;;;;   ;;;             ;;;   ;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;                       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;                   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;               ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;88888
8888;;;;;;;;;;;;;;;;;;;;;;8888888888888888888888888888888888888888888888888888888
8888;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;888
8888;;;;;;;;;   ;;;   ;;;   ;;;;;;;;;;888
8888;;;;;;;;;;             ;;;;;;;;;;;;;888
8888;;;;                         ;;;;;;;;;888
8888;;;;;;                     ;;;;;;;;;;;;;888
8888;;;;;;;                   ;;;;;;;;;;;;;;;;888
8888;;;                           ;;;;;;;;;;;;;;888
8888;;;;;                       ;;;;;;;;;;;;;;;;;;888
8888;;;;;;;                   ;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;                       ;;;;;;;;;;;;;;;;;;;;;;888
8888;;;; ;;;;;             ;;;;; ;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;               ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;  ;;;;   ;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;888
8888888888888888888888888888888888888888888888888888888888888888888888888
888888888888888888888888888888888888888888888888888888888888888888888888888

EDIT : added height as user input as ST3 suggested. it works best with big values (eg : 120)

Well, looks good, but where is user input? It is one of requirements.

I didn't know that (or at least didnt read it :)). I have updated answer.

Your Moon features 6 triangles. Should have 8. Further, it crashed my browser for large values.

I revisited whole code. Rendering is now closer to original flag and looks better, especially for low height values (eg : 20 pixels). Moon has been fixed and has the right number of triangles (the star was too low to view all of them). Recommanded height value is "100".

Crazy excellent submission.

Mathematica
Nepal's Interim Constitution - Schedule 1 (rel. to Article 6), pp. 260 and 262, provides 25 detailed instructions about how to construct the flag. (see http://www.ccd.org.np/resources/interim.pdf). The numbers in the comments refer to the corresponding instructions in the constitution.
We will need functions to draw equilateral triangles and determine the distance from a point to a line:
ClearAll[triangle]
triangle[a_?NumericQ,b_?NumericQ,c_?NumericQ,labeled_:True]:=
Block[{x,y,pt,sqr},sqr=#.#&;
pt[a1_,b1_,c1_]:=Reduce[sqr[{x,y}]==b1^2&&sqr[{x,y}-{a1,0}]==c1^2&&y>0,{x,y}];
{(
(*Polygon[{{0,0},{a,0},{x,y}}]*)
Polygon[{{-a/2(*0*),0},{a/2,0},{x-a/2,y}}]),
If[labeled,
{Text[Style[Framed[a,Background->LightYellow],11],{a/2,0}],
Text[Style[Framed[b,Background->LightYellow],11],{x/2,y/2}],
Text[Style[Framed[c,Background->LightYellow],11],{(a+x)/2,y/2}]},{}]}/.ToRules[pt[a,b,c]]]

(*distance from point to a line *)
dist[line_,{x0_,y0_}]:=(Abs[a x0+b y0+c]/.{x0-> m[[1]],y0-> m[[2]]})/Sqrt[a^2+b^2]; (* used below *)

The remaining code, with numbers referring to the instructions. By far, the most challenging part is to make the rays for the moon and the sun.  GeometricalTransformation comes in handy for doing translations and rotations.
    (*shape inside flag*)
(*1*)
w=100;a={0,0};b={w,0};
lAB=Line[{a,b}];
tA=Text["A",Offset[{-10,-20},a]];
tB=Text["B",Offset[{20,-20},b]];

(*2*)
c={0,w 4/3};d={0,w};
lAC=Line[{a,c}];
tC=Text["C",Offset[{-10,20},c]];
lAD=Line[{a,d}];
tD=Text["D",Offset[{-10,0},d]];
lBD=Line[{b,d}];

(*3*)
e=Solve[(x-w)^2+y^2==(w)^2&&y==w-x,{x,y}][[1,All,2]];
tE=Text["E",Offset[{15,0},e]];

(*4*)
f={0,e[[2]]};tF=Text["F",Offset[{-10,0},f]];
g={w,e[[2]]};tG=Text["G",Offset[{15,0},g]];
lFG=Line[{f,g}];
poly={a,b,e,g,c};

(*5*)lCG= Line[{c,g}];

(*moon*)
(*6*)
lineCG=N[((f[[2]]-c[[2]])/w)x+c[[2]](*100*)];
h={w/4,0};tH=Text["H",Offset[{0,-20},h]];
i={h[[1]],lineCG/.x->h[[1]]};tI=Text["I",Offset[{10,0},i]];
lHI={Dashed, LightGray,Line[{h,i}]};

(*7*)
j={0,f[[2]]+(c[[2]]-f[[2]])/2};tJ=Text["J",Offset[{-10,10},j]];
lineJG=N[((f[[2]]-j[[2]])/g[[1]])x+j[[2]]];
k={Solve[lineCG==j[[2]],x][[1,1,2]],j[[2]]};tK=Text["K",Offset[{10,10},k]];
(*k={Solve[lineCG\[Equal]c[[2]],x][[1,1,2]],j[[2]]};tK=Text["K",Offset[{10,10},k]];*)
lJK={Dashed, LightGray,Line[{j,k}]};

(*8*)l={i[[1]],j[[2]]};tL=Text["L",Offset[{0,10},l]];
(*9*)lJG={LightGray,Dashed,Line[{j,g}]};
(*10*)m={h[[1]],(lineJG/.x-> h[[1]])};tM=Text["M",Offset[{0,10},m]];
(*11*)distMfromBD=dist[{1,1,-w(*100*)},m];
 n={i[[1]],m[[2]]-distMfromBD};tN=Text["N",Offset[{0,0},n]];
(*ln=Abs[l[[2]]-n[[2]]];*)
(*12*)o={0,m[[2]]};tO=Text["O",Offset[{-10,0},o]];
lM={Dashed,LightGray,Line[{o,{g[[1]],o[[2]]}}]};

(*13*)
radiusLN=l[[2]]-n[[2]];
p={m[[1]]-radiusLN,m[[2]]};tP=Text["P",Offset[{0,10},p]];
q={m[[1]]+radiusLN,m[[2]]};tQ=Text["Q",Offset[{0,10},q]];
moonUpperEdge={White,Circle[l,radiusLN,{Pi,2 Pi}]};
moonLowerEdge={White,Circle[m,radiusMQ,{Pi,2 Pi}]};

(*14*)radiusMQ=q[[1]]-m[[1]];

(*15*)radiusNM=m[[2]]-n[[2]];
arc={Yellow,Circle[n,radiusNM,{Pi/7,6 Pi/7}]};
{r,s}=Solve[(x-l[[1]])^2+(y-l[[2]])^2==(radiusLN)^2 &&(x-n[[1]])^2+(y-n[[2]])^2==(radiusNM)^2,{x,y}][[All,All,2]];
tR=Text["R",Offset[{0,0},r]];
tS=Text["S",Offset[{0,0},s]];
t={h[[1]],r[[2]]};
tT={Black,Text["T",Offset[{0,0},t]]};

(*16*)radiusTS=Abs[t[[1]]-s[[1]]];
(*17*)radiusTM=Abs[t[[2]]-m[[2]]];

(*18 triangles*)
t2=Table[GeometricTransformation[GeometricTransformation[triangle[4,4,4,False][[1]],RotationTransform[k Pi/8]],{TranslationTransform[t]}],{k,-4,3}];
midRadius=(Abs[radiusTM+radiusTS]/2-2);
pos=1;table2=GeometricTransformation[t2[[pos++]],{TranslationTransform[#]}]&/@Table[midRadius {Cos@t,Sin[t]},{t,Pi/16,15 Pi/16,\[Pi]/8}];

(*19 sun*)u={0,f[[2]]/2};tU=Text["U",Offset[{-10,0},u]];
lineBD=N[(d[[2]]/w)x+d[[2]]];
v={-Solve[lineBD==u[[2]],x][[1,1,2]],u[[2]]};tV=Text["V",Offset[{10,0},v]];
lUV={LightGray,Dashed,Line[{u,v}]};

(*20*)w={h[[1]],u[[2]]};tW={Black,Text["W",Offset[{0,0},w]]};
(*21*)
(*22*)

t3=Table[GeometricTransformation[GeometricTransformation[triangle[9,9,9,False][[1]],RotationTransform[k Pi/6]],{TranslationTransform[w]}],{k,-3,9}];
midRadius3=(Abs[radiusTM+radiusTS]/2+2.5);
pos=1;
table3=GeometricTransformation[t3[[pos++]],{TranslationTransform[#]}]&/@Table[midRadius3 {Cos@t,Sin[t]},{t,0,2 Pi,2\[Pi]/12}];

Show[
Graphics[{Gray,
(*1*)lAB,tA,tB,
(*2*)lAC,tC,lAD,tD,lBD,
(*3*)tE,
(*4*)tF,lFG,tG,{Red,Opacity[.4],Polygon[poly]},
(*5*)lCG,
(*6*)tH,lCG,tI,lHI,
(*7*)tJ,lJK,tK,
(*8*)tL,
(*9*)lJG,
(*10*)tM,
(*11*)tN,
(*12*)lM,tO,
(*13*)moonUpperEdge,tP,tQ,
(*14*)moonLowerEdge,
(*15*)arc,tR,tS,tT,
(*16*){White,Dashed,Circle[t,radiusTS(*,{0, Pi}*)]},

(*17*){White,Opacity[.5],Disk[t,radiusTM,{0, 2 Pi}]},
(*18 triangles*){White,(*EdgeForm[Black],*)table2},
(*19 sun*)tU,tV,lUV,

(*20*)tW,{Opacity[.5],White,Disk[w,Abs[m[[2]]-n[[2]]]]},
(*21*)Circle[w,Abs[l[[2]]-n[[2]]]],
(*22*){Black(*White*),EdgeForm[Black],triangle[4,4,4,False](*table3*)},
{White,(*EdgeForm[Black],*)table3},

(*23*)
{Darker@Blue,Thickness[.03],Line[{a,b,e,g,c,a}]}

},
Ticks-> None(*{{0,100},{0,80,120,130}}*), BaseStyle-> 16,AspectRatio-> 1.3,Axes-> True],

(*cresent moon*)
RegionPlot[{(x-25)^2+(y-94.19)^2<21.4^2&&(x-25)^2+(y-102.02)^2>21.4^2},{x,0,100},{y,30,130},PlotStyle->{Red,White}]]

The following flag, from the above code, is made according to the instructions in the constitution.
Colors are modified to enable easier viewing of the construction lines.
The letters refer to points and lines in the instructions.

By the way, flags of the world can be called up directly within Mathematica.  For example:
Graphics[CountryData["Nepal", "Flag"][[1]], ImageSize->{Automatic,200}]

uhm, that's like cheating...

friol, Yes, I agree. That's why I included a variation.

IMO this doesn't break the rule, as there are no resources being loaded from the web directly.

Mathematica always allows ways to cheat.

@ST3 Mathematica is the cheat.

Should have 12 triangles in the Sun and 8 in the Moon. You got 9 and 16.

Victor, I corrected the number of triangles.

Python
import turtle, sys
from math import sqrt, sin, cos, pi

height = int(sys.argv[1])
width = height / 4 * 3
turtle.screensize(width, height)
t = turtle.Turtle()

# the layout
t.pencolor("#0044cc")
t.fillcolor("#cc2244")
t.pensize(width / 25)
t.pendown()
t.fill(True)
t.forward(width)
t.left(135)
t.forward(width)
t.right(135)
t.forward(width / sqrt(2))
t.right(90)
t.goto(0, height)
t.forward(height)
t.fill(False)
t.penup()

# the bottom star
t.fillcolor("#ffffff")
t.pencolor("#ffffff")
t.pensize(1)
radius = width / 5
x = width / 4
y = height / 4
t.goto(x + radius, y)
t.pendown()
t.fill(True)
for i in range(24):
    t.goto(x + radius * (5 + (-1) ** i) / 6 * cos(i * pi / 12), y + radius * (5 + (-1) ** i) / 6 * sin(i * pi / 12))
t.fill(False)
t.penup()

# the top star
radius = width / 9
x = width / 4
y = height * 2 / 3
t.goto(x + radius, y)
t.pendown()
t.fill(True)
for i in range(28):
    t.goto(x + radius * (6 + (-1) ** i) / 7 * cos(i * pi / 14), y + radius * (6 + (-1) ** i) / 7 * sin(i * pi / 14))
t.fill(False)
t.penup()

# the moon
radius = width / 5
x = width / 4
y = height / sqrt(2)
t.goto(x + radius, y)
t.pendown()
t.fill(True)
for i in range(30):
    t.goto(x + radius * cos(i * pi / 30), y - radius * sin(i * pi / 30))
for i in range(30):
    t.goto(x - radius * cos(i * pi / 30), y - radius / 2 * sin(i * pi / 30))
t.fill(False)
t.penup()
t.hideturtle()

raw_input("press enter")

Uses python's Tk turtles, example of python nepal.py 150 and python nepal.py 200 respectively:

Can you write the number of chars in your sourcecode?

Why? is this [tag:code-golf]?

The Moon should feature exactly 8 triangles. Yours has 9 and a half.

@Victor Fixed. Didn't realize that is a strict requirement

Python (+PIL), 578
Because I'm quite bored today..
from PIL import Image,ImageDraw
from math import*
I,k,l,m,n,o,_=Image.new('P',(394,480)),479,180,465,232,347,255;D=ImageDraw.Draw(I);P,G=D.polygon,D.pieslice
I.putpalette([_,_,_,0,0,_,_,20,60])
def S(x,y,r,e,l,b):
 p,a,h=[],2*pi/e,r*l;c,d=[0,-a/2][b],[a/2,0][b]
 for i in range(e):p+=[(x+r*cos(i*a+c),y+r*sin(i*a+c)),(x+h*cos(i*a+d),y+h*sin(i*a+d))]
 P(p,fill=0)
P([(0,0),(393,246),(144,246),(375,k),(0,k)],fill=1)
P([(14,25),(o,n),(110,n),(o,m),(14,m)],fill=2)
S(96,o,68,12,.6,0)
G([(31,90),(163,221)],0,l,fill=0)
G([(28,68),(166,200)],0,l,fill=2)
S(96,178,40,16,.7,1)
I.show()

You have two extra triangles on both the moon and the sun, should be 8 and 10, not 10 and 12 :)

PostScript
Code:
.15 .15 scale            % over-all scale

% draw the red area and blue border
7 7 moveto
360 7 lineto
128 240 lineto
367 240 lineto
7 467 lineto
closepath
gsave                    % save the outline path for further use
.86 .08 .24 setrgbcolor  % crimson red
fill                     % draw the red area
grestore                 % get back the saved outline path
0 .22 .58 setrgbcolor    % dark blue
14 setlinewidth
stroke                   % draw the blue border

1 setgray                % white

% draw the lower sun
96 130 translate         % coordinate origin of sun
69 0 moveto
12 {                     % 12 spikes
  69 0 lineto
  15 rotate
  46 0 lineto
  15 rotate
} repeat
closepath fill

% draw the upper sun
0 167 translate          % coordinate origin at center of sun
29 0 moveto
16 {                     % 16 spikes
  29 0 lineto
  11.25 rotate
  42 0 lineto
  11.25 rotate
} repeat
closepath fill

% draw the crescent moon
0 24 65 180 0 arc        % the lower arc
0 57 72 335 205 arcn     % the upper arc
closepath fill

showpage

The flag size can be controlled by specifying
the resolution in the Ghostscript call.
Result (height of flag is 480 pixels, created by gswin64c -r480 nepal.ps):

Result (height of flag is 120 pixels, created by gswin64c -r120 nepal.ps):


text:
Wikipedia: Philosophy!
As many geeks may know most pages (95% i think) on wikipedia eventually lead to Philosophy like this:
Click on the first non-italic or in parentheses link that is to another normal article: (i.e. not File: or Special:, but things like Wikipedia: are OK) and repeat on that one until you hit philosophy.
The script must:

Take a first page as input
Print the name of each article it gets to
And print how many articles it took to get to Philosophy, and if it didn't say so.

You start with 1000 points, and lose one for each character in the code, Bonus points for:
Detecting looping articles and stopping: +50
Detecting looping articles and requesting if the user should go to the next link on the article: +170
Allowing for a default on the former check as a command-line arg or similar: +140
Highest score wins.

+1, great challenge! This parenthesis detection is hard :P

I get the feeling this could use some better definition, but I'm not sure exactly how so just yet.

Lose one point for each character typed. Hmm. Great, I got it, I'll just copy-paste the characters! No points lost!

Edited to fix that Quincunx! ;)

I keep getting stuck on http://en.wikipedia.org/wiki/Logic because of the cite note! :P I suppose brackets count as parentheses, right?

Doorknob, 'Another normal article'. So not links to a different part of the the current.

alright, thanks. I think I did it! Yay! Now just need to add the counting how many articles part...

@DoorknobofSnow Wow that was fast.

@Quincunx Thanks ;) I posted my answer.

Should i disallow libraries that don't come with the language? Maybe just -100 pts for each?

Yeah I think im gonna do that.

Please don't change the rules after answers have already been posted; that's quite rude and generally frowned upon in the community here...

May I write a userscript, and use the URL it's running on as the input?

"Detecting looping articles and requesting if the user should go to the next link on the article" -- I need clarification. Do you mean the first link of the article that was given as output, and that the user may only be asked after the answer has been given?

http://xefer.com/wikipedia

Do you mean, either the link is non-italic, or it's in parentheses, or is the non "distributed" to mean, non-italic and non-in-parens?

+1 to @DoorknobofSnow regarding changing the rules after a challenge is submitted. If you're not sure about the rules of a challenge, you should run it through the Sandbox in Meta before posting it.

Ruby, 1000 - 303 299 337 - 50 373 - 170 382 - 170 - 140 379 - 170 - 140 chars = 697 701 713 797 928 931
I'm sure there are many improvements to be made.
(This requires Nokogiri)
require'open-uri'
require'nokogiri'
x="/wiki/"+gets.chomp
r=[n=i=0]
until x=~/\/Philosophy/
d=Nokogiri.HTML open"http://en.wikipedia.org#{x}"
x=d.css('p a').select{|a|t=a.xpath('preceding::text()').map(&:text)*'';t.count('(')==t.count(')')&&a.attr('href')=~/^.wiki[^:]+$/}[i].attr'href'
i=0
puts r.index(x)?"#{$><<'i=';i=($*[0]||gets).to_i;''}": r.push(x)[-1][6..-1]
n+=1
end
p n

Example run:
c:\a\ruby>wikipedia_crawl_philosophy
Latin (note: this is my input)
Classical_antiquity
History
Umbrella_term
Terminology
Word
Linguistics
Science
Knowledge
Fact
Proof_(truth)
Argument
Logic
Reasoning
Consciousness
Quality_(philosophy)
Property_(philosophy)
Modern_philosophy
Philosophy
18

Sample one where I had to go to a different link
c:\a\ruby>wikipedia_crawl_philosophy
Snow
Precipitation_(meteorology)
Meteorology
Atmospheric_physics
Synoptic_scale_meteorology
i=2 // I put the 0-indexed number of the link I wanted to go to (so, the third link)

Weather
Atmosphere
Gas
State_of_matter#The_four_fundamental_states
Physics
Natural_science
Sciences
Knowledge
Fact
Proof_(truth)
Argument
Logic
Reasoning
Consciousness
Quality_(philosophy)
Property_(philosophy)
Modern_philosophy
Philosophy
25

Tricks I used:

I used the selector p a to only get non-italic links, because all links in the actual article that are not italics are always in paragraph elements in Wikipedia.

hmmm... maybe i should disallow any but librarys that come with the language...

@user1825860 It's not actually a library that comes with the language; it's a gem. I edited my answer. But really, you want to take this already hard challenge and force us to not use HTML parsing libraries too? :P

i'm not disallowing it but you lose points :P

You should reread the first post and edit accordingly :P

@user1825860 Please don't change the rules after answers have already been posted; that's quite rude...

sorry. alright.

Will add cmd line default when I get home in 9 hours or so; should be pretty easy ;)

Micro-improvements: chop instead of chomp, *r= instead of r=[...],eval instead of .to_i, possibly << instead of push.

Random fact: as of today, your first example leads to a loop: Latin -> Classical_antiquity -> History -> Umbrella_term -> Cryptology -> Adversary_(cryptography) -> Cryptography ... (Cryptology and Cryptography are the same page.) Wikipedia's not as philosophical as it was! =O

Scala (294 chars => 1000-294+140 = 846 points)
The updated solution which automatically takes the next link if one has already been consumed. Thanks for the 140 bonus points.
Logic:
Pick up the first "/wiki" link that doesn't have a ":" in it (so it ignores "File:" links). Rinse and repeat with recursion returning the count + 1 every time. I keep a list of all previous outputs handy so the program doesn't go into an infinite loop.
Regular Expression: I have 2 forms of the regular expression.

"
.*?\"/wiki/([^:]*?)\".*?/p>" which finds links within the
 tags
"p>.*?/wiki/([^:]*?)\"" which is a slightly more experimental tag that has proven to work but provide different results because it, at times, picks up links from the right side info bar. These are regular articles so I believe it is still valid. If it's adjudged to not be, the OP (or someone else) can leave me a comment and I can update my solution to a better reg-ex.

I'm going to be using the second regular expression until I find a test case where it doesn't work or the OP mentions picking up links from the side bar aren't allowed (in my opinion, the info bars are still part of the actual article itself; more of a summary).

Minified Source:
object W extends App{print(x(Seq(args(0))));def x(s:Seq[Any]):Int={val? =s.last;println(?);?match{case "Philosophy"=>1;case _=>x(s:+"p>.*?/wiki/([^:]*?)\".*?/p>".r.findAllMatchIn(io.Source.fromURL("http://en.wikipedia.org/wiki/"+ ?).getLines.mkString).map(_ group 1).filter(!s.contains(_)).next)+1}}}

Readable Source:
object W extends App {
  print(x(Seq(args(0))))

  def x(s: Seq[Any]): Int = {
    val ? = s.last
    println(?)
    ? match {
      case "Philosophy" => 1
      case _ => x(s :+ "p>.*?/wiki/([^:]*?)\"".r.findAllMatchIn(io.Source.fromURL("http://en.wikipedia.org/wiki/" + ?).getLines.mkString).map(_ group 1).filter(!s.contains(_)).next) + 1
    }
  }
}

Sample Output:
Input
Space_toilet

Output
Space_toilet
Weightlessness
G-force
Weight
Force
SI_unit
French_language
Second_language
Language_acquisition
Word
Linguistics
Science
Latin_language
Pontifical_Academy_for_Latin
Pope_Benedict_XVI
Pope_Benedict_(disambiguation)
Regnal_name#Catholic_Church
Monarch
State_(polity)
Community
Commutative_property
Mathematics
Quantity
Property_(philosophy)
Modern_philosophy
Philosophy
26

Scala doesn't require a main object or method. You can run it with the interpreter as "scala  [args..]". Use args(0) to get the first argument, get rid of your object and main definitions, and I think you can remove the :Int too. http://pastebin.com/YqywKcG8

Turns out you can't remove the : Int. Didn't realize you were doing a recursive call. Also my pastebin was taken from your old Readable Source, but the same concepts apply.

I'll try out getting rid of the main method. And yeah, recursive calls made me add the :Int there. Later today, I'll also add a readable form of the 333 char solution I have.
Thanks for the suggestions @KChaloux

Like I said, the reference to object Q extends App { ... } is totally unnecessary if you run the code with the interpreter rather than compiling with scalac. Just run with scala <filename> [args..]

"BASH" – (If not mistaken: 1000 - 397 + 170 + 140 = 913 points)
"BASH" – (If not mistaken: 1000 - 386 + 170 + 140 = 924 points)
"BASH" – (If not mistaken: 1000 - 381 + 170 + 140 = 929 points)
BASH is in quotes on purpose as this is a mix of tools used in *nix shells but wrapped in a bash script.
Edit 1:

Removed http:// as curl defaults to this.
Changed href= match on anchors to f= as  does not have any other normal attributes ending in f. (It is a possibility of custom tags. Have not seen any so far.)
Set exit message on not found to !Phil instead of NoPhil. This one is a bit quirky as One could also say e.g. !, 0, N, !P or similar.
Quirk two: -s on curl could be removed to reduce by three more bytes, but that would yield a messy output. Not sure if that is an issue.
Updated help on this page.

Using quirks, code would end up at 379 bytes, 931 points.
I could also implement @plannapus usage of matching (hopefully) navigation box by adding (p|ul).*?<(\1) adding six bytes (subtracting six points).
Edit 2:
Using ${#c[@]} to print degrees of separation instead of $i counter.
Using quirks, code would end up at 374 bytes, 936 points.

I summon Cthulhu and go for a regexp + bash/shell/*nix solution.
Stolen:

Using
 trick from @Doorknob of Snow.

Implemented:

Detect loop and ask if next link should be taken.
Optionally select next link on duplicate as option.

Requirements:

bash v.?
grep with -P (PCRE) support.
sed
curl
cut

Usage:
script PATH [OPTIONS]

Print separation of article from ``PATH'' to ``Philosophy'' on Wikipedia.
Degrees of separation, if found, is printed as last line.
If not found last line yields ``!Phil''.

PATH
     Absolute path to starting article, e.g: /wiki/Word
OPTIONS
     y   Automatically select next link if already visited.
     n   (Or other) Quit if next link already visited.
BUGS
     1. On previous visit; "next link" is not checked. Thus if next link
     has already been visited we get eternal loop. Not sure if this
     disqualify +170 points.
     2. Sure there are.

Inline code. Copy to file. chmod +x filename. Run by ./script /wiki/… from bash shell.
u=($1);c=($1);while ! [[ "$u" =~ /Philosophy$ ]];do echo "$u";u=($(curl -s "en.wikipedia.org$u"|tr '\n' ' '|grep -Po '
.*?
'|sed 's/>[^<]*([^)]*)//g'|grep -o ']*f="/wiki/[^":]*"'|cut -d\" -f2));for x in "${c[@]}";do if [ "$x" = "$u" ];then [ $2 ] &&s=$2||read -p "${u[0]}?" s;[ $s = y ] &&u[0]=${u[1]}||{ echo "!Phil";exit;} fi;done;c=("${c[@]}" "$u");done;echo ${#c[@]};

Expanded and explained code:
u=($1); # Array of paths.
c=($1); # Array of visited paths.
# While $u != /Philosophy, ugly trick is to use $u instead of ${u[0]}.
while ! [[ "$u" =~ /Philosophy$ ]];do
        echo "$u";      # Print current page.
        # curl   : prints retreived page to stdout. "-s" could be skipped.
        # tr     : replace all newline with space. This is a ®sanity thing when it comes to
        #          twidling with html using regex.
        # grep 1 : match
 tags. Using -P's ungreedy *?.
        # sed    : remove all occurences of "(" something ")".
        # grep 2 : match links where "href" attribute starts with /wiki/ and is not e.g. File:
        # cut    : match actual href value.
        # Result is added to array ``u''.
        u=($(curl -s "en.wikipedia.org$u" |
                tr '\n' ' ' |
                grep -Po '
.*?
' |
                sed 's/>[^<]*([^)]*)//g' |
                grep -o ']*f="/wiki/[^":]*"' |
                cut -d\" -f2));

        # For previously visited pages as x.
        for x in "${c[@]}"; do
                # If x equals to first page ...
                if [ "$x" = "$u" ]; then
                        # Use option or ask.
                        [ $2 ] && s=$2 || read -p "${u[0]}?" s;
                        # If response is "y" use next link, else exit with status.
                        [ $s = y ] && u[0]=${u[1]} || {
                                echo "!Phil";
                                exit;
                        }
                fi;
        done;
        # Append current link to "visited"
        c=("${c[@]}" "$u");
done;
# Print number of visited pages.
echo ${#c[@]}

Darn it, you beat me by one point! :P I'm going to have to golf my solution more

Ye ;), but not sure this is valid code. Using tools this way.

JavaScript 726 (444 chars [556] + 170)
Now I appreciate that this might not be valid as a bookmarklet, but I've enjoyed tinkering with it anyway.
Usage: Navigate to the page you'd like to start from and run the following in the console:
(function(a){c=0,o="";$(u="html")[u](f=$('').on("load",function(){$=f.contentWindow.$;p=f.contentDocument.title[s="split"](" - ")[0];c++;p=="Philosophy"?document.write("
"+o+p+"\n"+c):(i=RegExp("^"+p+"$","m").test(o)?a||confirm("Loop, try next?")?2:0:1)&&(f.src=$("p>a").filter(function(){return(t=$(this).parent()[u]()[s](this.outerHTML)[0])[s]("(").length==t[s](")").length})[--i].href);o+=p+"\n"})[0])})(true)

For JavaScript the output is the following:
JavaScript
Interpreter (computing)
Computer science
Science
Knowledge
Fact
Proof (truth)
Argument
Logic
Reason
Consciousness
Quality (philosophy)
Property (philosophy)
Modern philosophy
Philosophy
15

This solution will assume you want to jump to the next link on a loop being detected, but if you change the true at the end to false it'll pop up a confirmation box instead (quite annoying...) not sure if that qualifies for the secondary bonus or not. I'll assume not.
Indented:
(function(l){
    c=0,o='';
    $(u='html')[u](f=$('').on('load',function(){ // Firefox needs the ? to properly load the frame
        $=f.contentWindow.$; // reference repeated calls as strings to save more bytes
        p=f.contentDocument.title[s='split'](' - ')[0]; // get the title

        c++;
        p=='Philosophy'?
            document.write('
'+o+p+'\n'+c): // pre for nice formatting
            (i=RegExp('^'+p+'$','m').test(o)?
                l||confirm('Loop, try next?')?
                    2: // desired index + 1 so we can use as a boolean
                    0
                :
                1)&&
            (f.src=$('p>a').filter(function(){
                return (t=$(this).parent()[u]()[s](this.outerHTML)[0])[s]('(').length == t[s](')').length // shorter, but still not overly happy with this...
            })[--i].href);
            o+=p+'\n' // update output
    })[0])
})(true) // change this to show confirm box when loop detected

So I originally missed the part about ignoring items in parens, adding that made it a lot more wordy, so I'm hoping to golf that filter function down (or hopefully replace it entirely).
Working in both Chrome and Firefox (tested in Firefox 26)

Looks awesome, but fails in Firefox 20.

Argghh! I only tested Chrome. I'll look into it!

@boothby Should be working in Firefox now... Still want to work on the links I'm choosing though!

C# - 813 chars
Score: 1000-813+50+170+140 = 547 :(
No external libraries. Loop detection.
First argument is the Source Article, second is the Target Article.
Golfed version:
class Program
{
    static void Main(string[] a)
    {
        Func<XmlDocument,IList<string>> G=delegate(XmlDocument xd){return xd.SelectNodes("//p//a[starts-with(@href,'/wiki/') and not(contains(@href,':'))]").Cast<XmlNode>().Select(n=>n.Attributes["href"].InnerText).ToList();};Action<string> W=delegate(string s){Console.WriteLine(s);};var h=new HashSet<string>();var c=new WebClient();var x=new XmlDocument();var t=c.DownloadString(@"http://wikipedia.org/wiki/"+a[0]);int i=0,C=0;
    GO:
        x.LoadXml(t);var ns=G(x);
    COL:
        var f=ns[i];if(f.Equals("/wiki/"+a[1],StringComparison.OrdinalIgnoreCase)){goto END;}if(h.Contains(f)){W("loop: "+f);i++;goto COL;}else{h.Add(f);i=0;C++;}W(f);t=c.DownloadString(@"http://wikipedia.org"+f);goto GO;
    END:
        W("Found in "+C);
    }
}

Intelligible version:
class Program
{
    // arg[0] source article. arg[1] target article
    static void Main(string[] arg)
    {
        Func<XmlDocument, IList<string>> G = delegate(XmlDocument xd)
        {
            return xd.SelectNodes("//p//a[starts-with(@href,'/wiki/') and not(contains(@href,':'))]").Cast<XmlNode>().Select(n => n.Attributes["href"].InnerText).ToList();
        };
        Action<string> W = delegate(string s) { Console.WriteLine(s); };
        var h = new HashSet<string>(); var c = new WebClient(); var x = new XmlDocument();
        var allText = c.DownloadString(@"http://wikipedia.org/wiki/" + arg[0]);
        int i = 0; int C = 0;
    GO:
        x.LoadXml(allText);
        var ns = G(x);
    COL:
        var f = ns[i];
        if (f.Equals("/wiki/" + arg[1], StringComparison.OrdinalIgnoreCase))
        {
            goto END;
        }
        if (h.Contains(f))
        {
            W("loop: " + f); i++; goto COL;
        }
        else
        {
            h.Add(f); i = 0; C++;
        }
        W(f);
        allText = c.DownloadString(@"http://wikipedia.org" + f);
        goto GO;
    END:
        W("Found in " + C);
    }
}

Example run, from "Sky" to "Philosophy":
C:\>wiki.exe Sky Philosophy

/wiki/Earth
/wiki/Geometric_albedo
/wiki/Phase_angle_(astronomy)
/wiki/Observational_astronomy
/wiki/Astronomy
/wiki/Natural_science
/wiki/Sciences
/wiki/Latin_language
/wiki/Classical_antiquity
/wiki/History
/wiki/Ancient_Greek
/wiki/Greek_language
/wiki/Modern_Greek
loop: /wiki/Greek_language
/wiki/Colloquialism
/wiki/Word
/wiki/Linguistics
/wiki/Science
loop: /wiki/Latin_language
/wiki/Knowledge
/wiki/Fact
/wiki/Latin
loop: /wiki/Classical_antiquity
/wiki/Italic_languages
/wiki/Indo-European_languages
/wiki/Language_family
/wiki/Language
/wiki/Human
/wiki/Extinct
/wiki/Biology
loop: /wiki/Natural_science
/wiki/Life
loop: /wiki/Earth
/wiki/Physical_body
/wiki/Physics
loop: /wiki/Greek_language
loop: /wiki/Natural_science
/wiki/Matter
/wiki/Rest_mass
/wiki/Center_of_momentum_frame
loop: /wiki/Physics
/wiki/Inertial_frame
loop: /wiki/Physics
/wiki/Frame_of_reference
loop: /wiki/Physics
/wiki/Coordinate_system
/wiki/Geometry
loop: /wiki/Ancient_Greek
/wiki/Mathematics
/wiki/Quantity
/wiki/Property_(philosophy)
/wiki/Modern_philosophy
Found in 41

C:\>

R, 379 characters; 1000-379+170=791 points
Version that ask users how to proceed when looping detected
library(XML);w="http://en.wikipedia.org";W="/wiki/";n=1;A=c(scan(,""));while(A[n]!="Philosophy"){a=paste0(w,W,A[n]);d=sapply(strsplit(grep(W,sapply(xpathApply(xmlParse(readLines(a)),"//p/a[@href]|//ul/li/a[@href]",xmlAttrs),`[`,'href'),v=T),"/"),`[`,3);B=d[-grep(":",d)];n=n+1;if(B[1]%in%A)if(readline("Loop!2nd link?")=="n")break;A[n]=head(B[!B%in%A],1);cat(A[n],"\n")};cat(n-1)

With indentations and comments:
library(XML) #Uses package XML
w="http://en.wikipedia.org"
W="/wiki/"
n=1
A=c(scan(,"")) #Stdin + makes it a vector so we can store each iteration
while(A[n]!="Philosophy"){
    a=paste0(w,W,A[n])
    d=sapply(strsplit(grep(W,sapply( #The heart of the program
             xpathApply(xmlParse(readLines(a)),"//p/a[@href]|//ul/li/a[@href]",xmlAttrs),
             `[`,'href'),v=T),"/"),`[`,3)
    B=d[-grep(":",d)] #get rid of Templates, Files ,etc...
    n=n+1
    #Ask user if should proceed when loop encountered
    #(any answer other than "n" is considered agreement):
    if(B[1]%in%A)if(readline("Loop!2nd link?")=="n")break
    A[n]=head(B[!B%in%A],1) #Take the first link that is not redundant
    cat(A[n],"\n")
    }
cat(n-1)

Example run:
> library(XML);w="http://en.wikipedia.org";W="/wiki/";n=1;A=c(scan(,""));while(A[n]!="Philosophy"){a=paste(w,W,A[n],sep="");d=sapply(strsplit(grep(W,sapply(xpathApply(xmlParse(readLines(a)),"//p/a[@href]|//ul/li/a[@href]",xmlAttrs),`[`,'href'),v=T),"/"),`[`,3);B=d[-grep(":",d)];n=n+1;if(B[1]%in%A)if(readline("Loop!2nd link?")=="n")break;A[n]=head(B[!B%in%A],1);cat(A[n],"\n")};cat(n-1)
1: Extended_ASCII
2:
Read 1 item
Eight-bit
Computer_architecture
Computer_science
Science
Logic
List_of_aestheticians
Art
Human_behavior
Behavior
Organism
Biology
Loop!2nd link?y
Mathematics
Quantity
Property_(philosophy)
Modern_philosophy
Philosophy
16

R, 325 characters; ??? points
Version that, by default takes first non-redundant link (i. e. non-looping).
library(XML);w="http://en.wikipedia.org";W="/wiki/";n=1;A=c(scan(,""));while(A[n]!="Philosophy"){a=paste0(w,W,A[n]);d=sapply(strsplit(grep(W,sapply(xpathApply(xmlParse(readLines(a)),"//p/a[@href]|//ul/li/a[@href]",xmlAttrs),`[`,'href'),v=T),"/"),`[`,3);B=d[-grep(":",d)];n=n+1;A[n]=head(B[!B%in%A],1);cat(A[n],"\n")};cat(n-1)


text:
Singular or plural?
Here is a list of 30 English nouns in their singular and plural form. Your job is simply to write the shortest regular expression that matches all the nouns in one form and none in the other (easy, all English nouns end in s in plural form right?).
SINGULAR     PLURAL
---------    --------
car          cars
boat         boats
man          men
woman        women
omen         omens
bus          buses
cactus       cacti
spy          spies
pie          pies
louse        lice
mouse        mice
amice        amices
goose        geese
creese       creeses
person       people
child        children
siren        sirens
ox           oxen
foot         feet
tooth        teeth
formula      formulae
minx         minxes
sphinx       sphinges
wife         wives
knife        knives
ion          ions
criterion    criteria
jinni        jinn
zero         zeros
hero         heroes

Yes, some of the words have alternative forms, but these are the ones we're going to use.
Here is a script that can help you with the testing; just put your regex between the two slashes (/) on the first line.

Hmm, interesting challenge! I never knew the sphinx one; I always thought it was sphynxes :-P +1

glad you didn't add fish and sheep to the list :)

I'm probably missing something (this is not my first language, and most of us have scarce relationships with them anyways) but shouldn't the 4th entry be "women"?

@Tobia that was a typo, thanks. I also added two words since 30 felt rounder than 28. Hope I didn't mess up for anyone who might have started already.

@daniero well, 28 is a nice round number too (base 7 or base 28 or ...) (relevant spikedmath comic)

Typical English esoteric rules - for example, if plural for goose is geese, then how come the plural for moose is not meese? (Its actually moose - a gotcha there)

44, or 46 if delimiting // count:
dr|wome|[aglx]e|et|ti|ia|[^u]s$|nn$|^.ic|^me

42 (or 44 with delimiters)
^.(e[^r]|ic)|x.|..me|ia|ti|.l..|nn$|[^u]s$ - Try it online!
^.(e[^r]|ic)|x.|..me|ia|[adjlu]...$|[^u]s$ - Try it online!

65 or 67
^[lm]i[^n]|^ge|ti|ia|[l|a]e$|ox.|^(wo)?men$|dren|nn$|et|[netro]s$


text:
Count how many numbers are divisible by perfect numbers in a given range
Given two arbitrary integers \$a\$ and \$b\$, count how many numbers are divisible by perfect numbers in that given range (\$a\$ and \$b\$ both are inclusive).

In mathematics, a perfect number is a positive integer that is the sum
of its proper positive divisors, that is, the sum of the positive
divisors excluding the number itself.Equivalently, a perfect number is
a number that is half the sum of all of its positive divisors
(including itself), or \$σ(n) = 2n\$.

Input:
1 100

Output:
18

Use stdin and stdout for Input/Output
Your code must handle big integers, so it is not good enough to hard-code a list of perfect numbers.
Shortest code wins

18 is not a perfect number! I guess you meant 28? (Since 18!=9+6+3+2+1, while 28=14+7+4+2+1).

@Vereos the question says Count how many numbers are divisible by perfect numbers

Woah, I've been misleaded by the question's name. Thank you!

@Peter Taylor Arbitrary integers

Then I suggest you edit the question to make that explicit before people start submitting answers with 32-bit ints.

@PeterTaylor Is it okay now?

Well technically 1 is perfect...

How arbitrary is "arbitrary"? Is it enough to work within a language's limitations? (e.g.: AFAIK, PowerShell can only go up to 2^96-1)

@mniip, no it isn't. The empty set adds to 0, not 1.

@Iszi, PowerShell can use System.Numerics.BigInteger, surely?

@PeterTaylor First I've heard of it, but I'm also relatively new to this. I'll look into it. So far I've found that it is not built-in for PS 2.0 - you need 3.0 or later which is not installed by default on Windows 7.

Perl 6, 106 103 characters
my ($a,$b)=get.words;(($a..$b).grep: *%%any ($a..$b).grep: {$^n==[+] ($^n%%$_&&$_ for 1..^$^n)})[*.say]

There's a lot of syntax here, so hopefully this explanation helps at least a little to someone who knows a bit of Perl 5 syntax, though I won't explain every detail:
Finds all the perfect numbers in the range $a..$b: ($a..$b).grep: {$^n==[+] ($^n%%$_&&$_ for 1..^$^n)} (explained below). It then chooses all the numbers in the range $a..$b which are divisible (%%) by any of the perfect numbers it had found: (%a..%b).grep: * %% any ….
The final (…)[*.say] abuses the fact that any code (in this case *.say, which prints its argument and a newline) passed to the […] postfix will be given the list's length as its argument (so that one can, e.g., use the idiomatic @array[*-1] to get the last element of @array). This means that the (…)[*.say] here has the same effect as say (…).elems.
The part that finds all the perfect numbers in the range does so by returning only those numbers which are equal ($^n ==) to the sum of their divisors. [+] adds together the values following it, for 1..^$^n iterates over all numbers 1 to $^n-1 and assigns $_ to them, and $^n %% $_ && $_ returns $_ if $^n is divisible ($^n %% $_) by $_, or else False, thus creating a list that consists of the proper divisors of $^n and False objects, which numify to 0 when all the values are added together by [+].
Perl 6 uses arbitrary sized integers, so, if you have the resources and the time, it could technically compute for big integers

 Mathematica - 117
Naive approach, linear for the range size
With[{p=#(#+1)/2&/@Select[2^Range@@Floor@Log2@Sqrt@#-1,PrimeQ]},Length@Select[Range@@#,Or@@Divisible[#,p]&]]&@Input[]

The correct way would be constructing numbers from the perfect numbers that are in the given range of course.

C, 125120
a,b,c,p[4]={6,28,496,8128};main(i){for(scanf("%d%d",&a,&b);a<=b;a++)for(i=0;i<4;)if(a%p[i++]==0)c++,i=4;printf("%d",c);}

A little more readable:
a,b,c=0,i,p[4]={6,28,496,8128};
main()
{
    for(scanf("%d%d",&a,&b);a<=b;a++)
        for(i=0;i<4;)
            if(a%p[i++]==0)
            {
                c++;
                i=4;
            }
    printf("%d",c);
}

This works with signed 32bit integers, up to 2^31-1=2147483647.
C, 212209
#include<stdint.h>
uint64_t a,b,c,p[8]={6,28,496,8128,33550336,8589869056,137438691328,0x1fffffffc0000000};main(i){for(scanf("%lld%lld",&a,&b);a<=b;a++)for(i=0;i<8;)if(a%p[i++]==0)c++,i=8;printf("%lld",c);}

Should work up to 2^64-1=18446744073709551615.

In C global ints are initialized to 0 by default so you don't need to set c=0 :)

To save 1 char you could move one of your ints into the main declaration, ex main(i) (saves a comma character).

Oh, you're right! I also removed a couple of useless {}.

You can remove the pair of braces around your if statement by changing the contents to be c++,i=4;

Yes, I did it. Well, not in the prettified version, but that's not supposed to be short, isn't it?

Ah I missed that!

Haskell - 157
c x=x==sum[i|i<-[1..x-1],mod x i==0]
d x=any((0==).mod x)$takeWhile(<=x)(filter c[2..])
main=do m<-getLine;n<-getLine;print$length(filter d[read m..read n])

Can work with arbitrarily large numbers given respectively large time.
Input is given on 2 lines.

Python 3 [166 bytes]
a,b=map(int,input().split());print(len(set([n if n%p==0 else 0 for p in [x for x in range(a,b) if sum(y for y in range(1,x) if x%y==0)==x] for n in range(a,b+1)]))-1)

More readable:
// STDIN => a, b
a, b = map(int, input().split())

// list of perfect numbers
perfect = [x for x in range(a, b) if sum(y for y in range(1, x) if x % y == 0) == x]

// length(number % [any perfect number] == 0) => STDOUT
print(len(set([n if n % p == 0 else 0 for p in perfect for n in range(a, b + 1)])) - 1)

Here the list of perfect numbers is calculated inline but may be set statically. The number range should be bound by the machine's word size.
While this algorithm is deadly slow and takes ages for working with big numbers, it is at least short :)

Jelly, 10 bytes
rÆD=Æṣ$§TL

Try it online!
Requiring space separated STDIN input bumps the byte count up to 15 bytes
How it works
rÆD=Æṣ$§TL - Main link. Takes a on the left and b on the right
r          - Yield [a, a+1, ..., b-1, b]
 ÆD        - Generate the divisors of each
      $    - Over each list of divisors, d:
    Æṣ     -   Generate the proper divisor sum of each value in d
   =   §   -   Count how many are equal to their proper divisor sum
             This maps numbers with perfect to divisors to a non-zero value
             and those without to 0
        TL - Count the number of non-zero elements

Perl 5 -MList::Util=sum,any -pl, 77 bytes
$"=$_,$\+=any{$"%$_==0}grep{//;2*$_==sum grep{$'%$_==0}1..$_}2..$"for$_..<>}{

Try it online!
Ungolfed:
$_ = ; # implicit by -p command line switch
for$_($_..){ # loop over the range from $_ to the next input
   $"=$_;                           # store a copy of the current number ($_) so it can be used in sub-loops
   $\+=                             # counter for number of perfectly divisible numbers found
      any{$"%$_==0}                 # check if the current number ($") is evenly divisible by a:
         grep{//;2*$_==             # PERFECT NUMBER: a number where twice the number equals
            sum grep{$'%$_==0}1..$_ #                 the sum of the numbers which divide it evenly
         }2..$"                     # that exists in range of 2 to the current number
}
print$\; # implicit by -p command line switch

Vyxal, 11 bytes
ṡƛ'∆K=;Ḋa;∑

Try it Online!
9 bytes with s flag
12 bytes accounting for space seperated inputs
Explained
ṡƛ'∆K=;Ḋa;∑
ṡƛ       ;  # Over each item x in the range [input a, input b]
  '∆K=;     #   Keep items from the range [1, x] that are perfect numbers
       Ḋa   #   And is x divisible by any of those perfect numbers?
          ∑ # Sum the number of numbers that are divisible by a perfect number

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Largest Denominator
The number 1 can be written as sum of fractions of the form 1/p (where p>1). There are different ways to write it. You will be given an integer k which denotes the number of fractions to be used to get the sum as 1. You need to find the largest possible value of p among all possible ways. See sample input for clarity
Input Format:
The first line contains number of test cases t. Then t lines follow each having a single integer k.
Output:
You need to print the largest value of p modulo 10^9 + 7.
Constraints:
1<=t<=10^5
2<=k<=10^6

Sample Input ---------------   Sample Output
2                        2
2                        6
3

Explanation
There is only one way to write '1' as sum of two fractions. 1/2 + 1/2. hence the largest value is 2.
In the second test case, the only possible ways as sum of three fractions are:
1/3, 1/3, 1/3
1/6, 1/2, 1/3
1/4, 1/4, 1/2

Among these the second representation has the largest denominator which is '6' and hence the answer.

Ah, so the trivial solution of p = k is suboptimal. p modulo 10^9 + 7 not sure I get this though

what does 2 2\n2 6\n3 mean...

@mniip the left is input. The right is output. The first input number is the number of cases, so the 2 matches the 2, and the 3 matches the 6. The first 2 just says there's 2 cases.

wouldn't that be 2\n2 2\n3 6 then?

@mniip I can see how it's confusing, but that would imply that the output has to start with a newline. They're 2 separate boxes really, the fact that they're side by side is irrelevant. One is input and one is output

Java
I solved this basic problem on Stack Overflow already, so I might as well do it here, too. Follow the link for a deeper explanation of the algorithm, but there's no reason to calculate all the possible fractions if you just want to know the largest denominator.
The only major difference between the code here and on SO is that I'm using modular multiplication, since each result should be mod 10^9 + 7 and this speeds it up considerably.
public class Egyptian {
    static int range = 1000000;
    static long[] mods;
    static long mod = 1000000007;

    public static void main(String[] args){
        mods = new long[range+1];
        mods[1] = 1;
        for(int k=2;k<=range;k++){
            mods[k] = (mods[k-1] * (mods[k-1]+1)) % mod;
            System.out.println(mods[k]);
        }
    }
}

Note: This code simply calculates and outputs every value for inputs 2 to 10^6. As a popularity contest, I thought a simple proof of concept would be enough. Feel free to downvote if you disagree.
It runs in a few seconds, but most of that time is taken by the million-line output. If you just want to fill the array with correct values, it finishes in well under a second. You can then read/write the input/output at the speed of IO.
Output: (only from 2-40, can't exactly paste a million lines here)
2
6
42
1806
3263442
56876256
530809436
905136947
994707547
127363070
613638513
614624128
690044800
363952039
128981958
502041307
671991252
275513076
791142674
33665861
222603452
718053684
214817910
348558872
748018254
148507635
647419241
330373625
661987133
851958095
407158983
684304220
916206786
752612499
438658510
487129601
996482080
806772777
958888343

APL (50)
⍪{⌈/∊v/⍨{g=+/(g←∧/⍵)÷⍵}¨v←,∘.,∘v⍣(n-1)⊢v←⍳!n←⎕}¨⍳⎕

This code skips the 'p modulo 109 + 7' computation. But the algorithms is so slow (exponential) that you can barely get a result for k=5, let alone 109. Therefore by all practical means it can be considered equivalent to a piece of code that computed it :-)
Example
      ⍪{⌈/∊v/⍨{g=+/(g←∧/⍵)÷⍵}¨v←,∘.,∘v⍣(n-1)⊢v←⍳!n←⎕}¨⍳⎕
⎕:
      3
⎕:
      2
⎕:
      3
⎕:
      4
 2
 6
24

The ⎕: is just the "input prompt" when used interactively.

k=4 output should be 42: (1/2 + 1/3 + 1/7 + 1/42)