text:
Output all numbers below certain number containing certain digits
Output all numbers in certain range containing certain digits
Task

Take an input of digits through console, prompt, or a file (in the decimal number system). These digits should be separated by spaces.
Take an input of the "maximum" through console, prompt, or a file
If you use a file, the program must output "[Data taken from file]"
Print all natural numbers (including 0) below the maximum containing at least one of the digits specified by the user (they may contain other digits), separated by a single space. Leading 0s do not count!
If there is a sequence of 10 or more consecutive numbers, it should output the first and last, separated by a -->

Rules

Standard loopholes are (obviously) not allowed
Programs must complete the tasks above
The answer with the fewest characters wins

Examples
>>> 1 3
>>> 100
1 3 10 --> 19 21 23 30 --> 39 41 43 51 53 61 63 71 73 81 83 91 93

>>> 1 2 4 5 6 7
>>> 29
1 2 4 5 6 7 10 --> 28

>>> 0 1 2 3 4 5 6 7 8 9
>>> 9999999
0 --> 9999998

[Data taken from file]
1 3 5 7 9

Please be specific about the format for digits input: space separated (as in examples), comma separated, a single string (136) or whatever.

Does the arrow have to be -> or would a Unicode arrow like → also be fine?

@MartinBüttner It has to be -->.

GolfScript 74 71 (DEMO)
' ':§/)~\n*:x;,{`x&},99:c;{.c)=!{§\}*:c}%[§]/{.,9>{('-->'@)\;}{~}if}%§*

Description:
The code expects the parameters passed via the console, like so:
echo "1 3 100" | ruby golfscript.rb numbers.gs

Here's the annotated code:
' ':§/                  # Split input by space and save the
                        # space character in variable `§`

)~                      # Take the last input and convert to int
                        # This is the "maximum" parameter.

\n*:x;                  # Take the list of digits and join them with
                        # newlines, resulting in a string.
                        # Save the result in variable `x` and take it
                        # off the stack

,                       # Take the "maximum" parameter and make an
                        # array [0, max)

{`x&},                  # Filter the array, leaving only numbers that
                        # contain the right digits (that have at least
                        # one char in common with string `x`)

99:c;                   # Save the value 99 in a new variable, `c`.

{                       # For each element (`n`) in the array:
  .                     #   - duplicate `n` on the stack
  c)=!{§\}*             #   - if it does not equal `c`+1 add a space before it
  :c                    #   - assign the value of `n` to `c`
}%

[§]/                    # Split the resulting array by spaces

{                       # For each element `a` in the array of arrays:
  .                     #   - duplicate `a` on the stack
  ,9>                   #   - check if length > 9
  {('-->'@)\;}          #   - if `a`'s length is >9, then push "(min)", "-->" and "(max)"
                        #     on the stack
  {~}if                 #   - otherwise, just place the elements of the current array
                        #     on the stack
}%
§*                      # make a string representing the elements of the resulting array,
                        # separated by spaces

Ruby, 186 181 177 bytes
a=gets.split;puts ([0]+(0...gets.to_i).select{|x|(x.to_s.split('')&a).any?}).each_cons(2).slice_before{|m,n|m+1<n}.map{|a|c=a.map &:last;c.count>9?[c[0],'-->',c.last]:c}.join' '

Ungolfed explanation:
# Read numbers from input and split into array
a = gets.split

# Loop from 0 to maximum number, exclusive
puts ([0]+(0...gets.to_i).select { |x|
  # Only include numbers that include at least one input digit
  (x.to_s.split('')&a).any?
})    # Add dummy element to the beginning of array
.each_cons(2)   # Get each array of 2 consecutive elements
.slice_before { |m, n| #
  m + 1 < n # "Slice" the array if m and n are not consecutive
}.map { |a|
  c = a.map &:last # Get all the last elements in `a`
  if c.count > 9
    # 10 or more consecutive elements. Get the first and last, and
    # an arrow in-between
    [c[0],'-->',c.last]
  else
    c
  end
}.join ' ' # Add space in-between all elements, and print result

JavaScript (E6) 153 157 161 163 177
Input and output via prompt
The main loop filters the numbers with a regexp and builds spans of consecutive numbers (as arrays). The O function concatenates the spans converting them to string. If the elements in a span array are 10 or more, instead of taking all elelements it just take the first and last number.
Test in FireFox/FireBug console
P=prompt,m=P(d=P());
O=_=>(
  o+=s[9]?s[0]+" -->"+p:s.join(''),s=[]
);
for(s=[o=''],p=n=0;n<m;++n)
  (n+'').match("["+d+"]")&&
  (
    n+~p&&O(),s.push(p=' '+n)
  );
O(),P(o)

Mathematica, 233 191 171 165 bytes
t=StringSplit;Flatten[Split[Cases[Range@Input[d=t@InputString[]]-1,m_/;ToString@m~t~""⋂d!={}],#2-#<2&]/.{e:{__Integer}/;Length@e>9:>{#&@@e,"-->",Last@e}}]~Row~"  "

I'm taking the input from two prompts which is as close to command line as it gets in Mathematica.
Ungolfed:
t = StringSplit;
Flatten[
  Split[
    Cases[
     Range@Input[d = t@InputString[]] - 1,
     m_ /; ToString@m~t~"" \[Intersection] d != {}
     ],
    #2 - # < 2 &
    ] /. {e : {__Integer} /; Length@e > 9 :> {# & @@ e, "-->", Last@e}}
  ]~Row~"  "

I'm simply filtering a range with all numbers to the relevant ones and then I'm collapsing consecutive subsequences with a repeated rule replacement.

Shorter, using String to aid finding runs: t = StringSplit; Row[Flatten[   Split[ (Cases[Range[Input[d = t@InputString[]] - 1],        m_ /; ToString@m~t~"" \[Intersection] d != {}]), #2 - # == 1 &] /. {e : {a__Integer} /;        Length[{a}] > 9 :> {e[[1]] -> e[[-1]]}}], "   "]

@DavidCarraher Nice! Thanks a lot. I don't think the -> shortcut is fair game though. I'll ask the OP.

Shouldn't it be Range[0, Input[d = t@InputString[]] - 1] instead of Range[Input[d = t@InputString[]] - 1]?

@DavidCarraher Oh, I didn't see that 0 was included. But in that case decrementing the default range by 1 is shorter.

Yes, it's shorter, but it only tests through max-1, not max.

@David so does yours and that's the required behaviour

Hmm, the -1 can be removed from mine.  It will then behave properly!

@DavidCarraher But the upper end should be excluded from the range, as per the challenge spec.

You are correct! I hadn't noticed that in the specs.

Perl - 170 162
$a=<>;chop$a;$a=~s/ /|/g;@b=grep{/$a/}(0..<>-1);while(++$c<@b){if($b[$c]-$b[$c-1]>1){($e=$c-$d)>9&&splice(@b,$d+1,$e-2,'-->')&&($c-=$e-3);$d=$c}}print join' ',@b

Ungolfed with comments:
$a=<>;    #Read digits
chop$a;$a=~s/ /|/g;    #Turn digit string into regex
@b=grep{/$a/}(0..<>-1);    #Assign @b as list of numbers from 0 to second input which match the digits
while(++$c<@b){    #Loop $c through indexes of list
    if($b[$c]-$b[$c-1]>1){    #If next number is not consecutive, do arrow adding stuff
        ($e=$c-$d)>9&&    #If the number of previous consecutive numbers is at least 10
            splice(@b,$d+1,$e-2,'-->')&&    #Replace all but the first and last with '-->'
            ($c-=$e-3);    #Subtract from index to compensate for decreased list length
        $d=$c    #Set $d (fist index of consecutive range) to current index
    }
}
print join' ',@b    #Print the list

Ruby, 105 (or 110 if you need to add .chop to the gets to make your input work)
Run with command line flags pl.
r=/[#$_]/
$_=(?1...gets).grep(r).slice_before{|e|-1>eval("#@l-"+@l=e)}.map{|a|a[9]?[a[0],'-->',a[-1]]:a}*' '

Convert the first input to a character class in a regex. Generate all numeric strings between 1 and the next input (exclusive) and find the ones that match the regex. slice_before trick is stolen from August to find contiguous ranges, it gets shorter by using an instance variable to remember the last element so I don't need each_cons, but longer since I'm working with strings. I check for ranges of size 10 or more by seeing whether they have a 10th element or not (a[9]), and replace their internal elements with the arrow.

Python - 208 202 211
D=raw_input()
n=input()
s=[`i`for i in range(n)if sum(d in`i`for d in D)]
i=0
while i<len(s):
 j=len(s)
 while j:
  j-=1
  try:
   if int(s[j])-int(s[i])==j-i>8:s[i+1:j]=['-->']
  except:1
 i+=1
print' '.join(s)

Doesn't this produce a wrong output formating? For me (Python 2.7) it outputs something like ['1', '2', '3'].

@Emil: Sorry, fixed it.

Bash+coreutils, 94 bytes
seq -s\  0 $[$1-1]|sed -r "s/\b[^ ${2// }]+\b/:/g
s/([0-9]+)( [0-9]+){9,}/\1 -->\2/g
s/: ?//g"

seq generates all numbers below the maximum
The first sed line replaces any number not containing the interesting digits with :
The second sed line searches for runs of 10 or more space-separated numbers and replaces with start --> end
The final sed line removes unnecessary : and spaces.

Output:
$ ./belowdigits.sh 100 "1 3"
1 3 10 --> 19 21 23 30 --> 39 41 43 51 53 61 63 71 73 81 83 91 93
$ ./belowdigits.sh 29 "1 2 4 5 6 7"
1 2 4 5 6 7 10 --> 28
$ ./belowdigits.sh 999999 "0 1 2 3 4 5 6 7 8 9"
0 --> 999998
$

Python, 227
Currently the longest, but whatever.
a=raw_input().split()
l=[i for i in range(input())if any(x in str(i)for x in a)]
for i in l:
 for j in l[::-1]:
  try:L=l.index;l=l[:L(i)+1]+['-->']+l[L(j):]if j-i==L(j)-L(i)and j-i>8 else l
  except:1
print' '.join(map(str,l))

Haskell, 195 194
main=interact$(\[d,m]->v$f(any(`elem`f(/=' ')d).s)[0..read m-1]).lines
s=show
f=filter
v l@(x:m)|g l>x+8=unwords[s x,"->",s$g l,v$f(>g l)l]|0<1=s x++' ':v m
v[]=""
g s=f(`notElem`s)[s!!0..]!!0-1

not very short but Imho quite good for this specific question and language.

Python 2, 202 191
Another try at Python, using the same idea as @August's Ruby solution:
a=raw_input()
s=[x for x in range(input())if any(c in`x`for c in a)]
for _,g in __import__('itertools').groupby(s,lambda x:x+1in s):
 l=map(str,g)
 print len(l)<9and' '.join(l)or l[0]+' -->',

PS: Coincidentally, the first two lines ended up nearly identical to both other Python entries.

R 224 w/o Comment
a=as.character
l=length
x=a(scan())                                                 # Read digits
s=a(0:(scan()-1))                                           # Read max number
p=as.numeric(s[Reduce(`|`,lapply(x,function(x)grepl(x,s)))])# Find all numbers we want
j=1                                                         # Print the arrow "-->"
for (i in 1:l(z<-c(rle(diff(p))$l,1))){if(z[i]<9)cat(p[j:(j+z[i]-1)],"")else
cat(p[j],"-->","")
j=j+z[i]}

PHP, 273 258 255 248 256 239 234 bytes
What a mess.
Submission:
function n($s,$b){$r=$q=$f="";for($g=-1;$g++<$b;){$i=0;foreach(explode(" ",$s)as$d){$i+=in_array($d,str_split($g));}if($i&&$b-$g){$q[]=$g;$f=$f?:$g;}elseif($f){$r.=($g-$f>9?$q[0]." --> ".($g-1):implode(" ",$q))." ";$q=$f="";}}echo$r;}

Exploded view:
function n($s, $b) {
  $r = $q = $f = "";
  for ($g = -1; $g++ < $b;) {
    $i = 0;
    foreach(explode(" ", $s) as $d) {
      $i += in_array($d, str_split($g));
    }
    if ($i && $b-$g) {
      $q[] = $g;
      $f = $f ?: $g;
    } elseif ($f){
      $r .= ($g-$f > 9 ? $q[0] . " --> " . ($g-1)
                       : implode(" ", $q)        ) . " ";
      $q = $f = "";
    }
  }
  echo $r;
}

Variable explanations:
$b: string, upper bound (input)
$s: string, digit string (input)
$d: int, individual digit in $s
$g: int, current guess
$i: int, number of times a digit exists in the current guess
$f: int, first correct guess in a chain
$q: array, correct guess queue
$r: string, final result (output)
This is super unoptimized, still tweaking it.
Edits:
-18: Combining variable inits, merging two $i inits.
-7: Removing $a declaration.
+8: Fixed two bugs: now allows 0 as output, now allows $b-1 and --> $b-1 as output.
-17: God, I love ternary operators.
-5: Let's treat $i as an int full-time, and simplify the resets.


text:
Improvise a Hardware Random-Number Generator
Your task is to improvise a hardware random-number generator with whatever hardware you have lieing around.
Challenge
Write a program with the following properties:

It prints either 0 or 1 (and nothing else).
The output depends on a physical process and not just the internal state of the computer.
There is no relation between outputs of subsequent runs (one minute apart).
The output is not predictable with any realistic effort.
The probability of the output being 0 is between 0.2 and 0.8.
It runs in less than a minute with a reasonably high probability.

You must explain why your program has these properties, if it is not obvious.
Clarifications and Restrictions
The following may seem like an awful lot of restrictions for a popularity contest, but ultimatively it’s all to ensure that the program remains within the spirit of the question, somewhat works and to avoid solutions which are popular due to being a total overkill but are ultimatively rather boring.

The system time does not count as a physical process.
You may use any consumer-grade hardware you like from 8-inch floopy-disk drives to a USB rocket launcher to headphones – unless it is intended for random-number generation. A piece of hardware is consumer-grade, if it is mass-produced and costs less than 1000 $/€/£, so you cannot use radio telescopes, the CERN, MRIs or your home-built particle detector.
You can only make the most basic assumptions on the state and alignment of the hardware such as being switched on (if it has a power switch) and being properly installed and functional. For example you can assume a CD drive to be generally capable of reading a disk and not to be jammed, but you cannot assume it to be open or closed or to contain a disk. In another example you cannot assume two pieces of hardware to be aligned to allow for a special interaction, but you can assume them to be in the same room.
You may leave the hardware in any state you like, unless you break it.
You can and must assume the hardware to be in a natural environment, but nothing more. For example you can assume that the hardware is not positioned in a in tank of liquid helium nor in an extremely sound- and lightproof room nor in space. However, you cannot assume any sound- and lightsources to be present except those that are only avoidable with radical efforts.
Your program must run on a standard desktop computer with a non-esoteric operating system of your choice. You may employ any software that is not specifically designed for random-number generation.
You cannot assume Internet access.
You can neither assume humans to be present nor absent, but you can assume that nobody intentionally interfers with your program, e.g., by manually stopping a fan or running a program that does nothing but switching off the microphone as often as possible.
You can only make the most basic assumptions about the software settings. For example, you can assume drivers to be installed and activated but you must be prepared for the sound to be muted.
You may leave the software settings in any state you like.

Bonus
A special bounty was awarded to a particularly short solution. This was rather by numbers of instructions and similar than by characters. The winners were (tied according to my criteria):

This answer by Franki.
This answer by Tejas Kale.

I could only award one answer and Tejas Kale’s answer won by lot.

Is a gyroscope like those found in newer smartphones and laptops considered consumer hardware?

@NateKerkhofs: Yes.

Actually, could we get a definition of "consumer-grade hardware"? Is "anything you can buy at at your local computer store for less than 500 USD, or that you can get as part of a 1,000 USD machine" an acceptable definition?

@NateKerkhofs: Done.

"with whatever hardware you have lieing around." I actually have a radio tuned to static connected to my server at home to study generating random numbers with it... maybe that could enhance Ells answer...

No full-fledged answer, because I currently don't have access to the necessary hard- and software, but -in my experience- the readings of the accelerometer of a tablet or smartphone fluctuate (even when the device is not moved) and may contain enough noise for an RNG.

@SebastianNegraszus: There is already an answer using that.

Let me insert a little trivia here, there is a real random number generator based on Quantum Mechanics running at the Australian National University. Take a look: http://qrng.anu.edu.au/index.php

Cosmic-ray detectors are pretty good at this.

Shell
Reads a single sample from the microphone stream and prints its least-significant bit, which should be dominated by noise.
EDIT: Changed to unmute the microphone ... and everything else too!
# Warning - unmutes EVERYTHING!
for DEV in `amixer | grep Simple | sed -e "s/.*'\(.*\)'.*/\\1/" -e "s/ /~/g"`
do
    amixer -q -- sset "`echo $DEV | sed 's/~/ /g'`" unmute 100% 2>/dev/null
done

echo $(( `od -N1 -d < /dev/dsp | head -n1 | sed 's/.* //'` & 1 ))

What if I have the mic muted? Shouldn't this be perfect silence?

@yeti: Well, sure. But we're allowed to assume that "the hardware is switched on and functional", which I think covers that.

unmuting everything is quite a big (and annoying) side-effect to a "pseudo random" binary generator, to me ^^

You could try to feed the speakers with some data using cat /dev/urandom > /dev/dsp, just in case the computer is in a sound-proof room/chamber/box/case/space.

just what I wanted to do!

albeit I wanted the mic source from my arduino

@IsmaelMiguel Every ADC generates enough noise even without an actual signal.

I don't know till which point that assumption isn't against the rules.

@IsmaelMiguel: »you can assume that the hardware is not positioned […] in an extremely sound[…]proof room […].«

@Wrzlprmft "However, you cannot assume any sound- and lightsources to be present except those that are only avoidable with radical efforts." You forgot this part.............

@IsmaelMiguel: No I did not, but where did anybody assume the presence of such soundsources?

@Wrzlprmft I didn't, that's why I said to feed the speakers with some data. It will work, and it complies with this part of the 3rd rule: In another example you cannot assume two pieces of hardware to be aligned to allow for a special interaction, but you can assume them to be in the same room.. Feeding the speakers with some sound (making sure also that the volume is on max) will be more within the rules. Since they are in the same room, this is enough. Remember also that You can only make the most basic assumptions on the state and alignment of the hardware such as being switched on[...]

Bash
echo $[`ping -qc1 127.1|sed 's/[^1-9]/+/g'`0&1]

Gathers entropy from the response time of a single ping to localhost.
Note that the response time appears exactly thrice in the output of ping -qc1:
PING 127.1 (127.0.0.1) 56(84) bytes of data.

--- 127.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.044/0.044/0.044/0.000 ms

All other numbers and constant and – more importantly – independent from the response time.
sed 's/[^1-9]/+/g' converts every zero and non-digit into plus signs, and echo $[...0&1] prints the parity of the resulting sum.

It always prints 1 for me: CYGWIN_NT-6.2-WOW64 work 1.7.28(0.271/5/3) 2014-02-09 21:06 i686 Cygwin - ping has neither -q or -c here.

I don't know much about Cygwin. Is it possible that you are using de Windows ping utility?

Using Windows ping confirmed. I'm surprised.

Windows ping would return
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

@JamesSnell: That's the problem then. Windows ping doesn't have enough precision; it will always show a time of 1 ms...

Seems like this violates restriction #2: Pinging localhost depends entirely on the internal state of the computer.

Difficult to say. @Dennis: Do you know where the fluctuation comes from?

@Wrzlprmft: Quite frankly, no. A ping to localhost is handled by the loopback device (which is virtual), but it still has to be handled at least by the CPU, so it depends on a physical process.

I think in terms of rule coherence it would be safer to have a board with two Ethernet ports and a non-shielded cable between them, so your output depends more on the state of the cable and interference than the internals of the machine.

According to @tophyr, for i in {0..1000};do echo $[$(ping -qc1 127.1|sed 's/[^1-9]/+/g')0&1];done | sort | uniq -c could sometime present (on my host) 198 0 // 802 1 which violate rule #5. (too close to 0.2, sometime under.)

@F.Hauri: That's strange. On my machine, the zeros are always between 40 % and 60 % (and usually quite close to 50 %).

JavaScript + HTML5 DeviceMotion
var hash = function(x) {
    var h = 0
    for (var i = 0; i < x.length; i++) {
        h += x.charCodeAt(i)
        h ^= h << 5
        h ^= h >> 3
        h ^= h << 13
        h &= 0xffff
    }
    return h
}
var listener = function(e) {
    var accelerationString = JSON.stringify(e.acceleration)
    var hashed = hash(accelerationString)
    alert(hashed % 2)
    window.removeEventListener("devicemotion", listener, true)
}
window.addEventListener("devicemotion", listener, true);

JSFiddle here.
Uses the HTML5 DeviceMotion API on supported devices (mostly mobile devices). It turns the resulting acceleration object into JSON, hashes it, and takes the remainder modulo 2.
Most of the code is the hash function (damn you JavaScript, and your total lack of a standard library). It could probably be shorter, but I'm a sucker for a good hash function.

"Please shake the device to generate new password."

Python + Webcam
Using code shamelessly stolen from here, takes a shapshot using your webcam, hashes the data, and prints the least significant bit.
#!/usr/bin/python
import pygame.camera, hashlib

pygame.camera.init()
cam = pygame.camera.Camera(pygame.camera.list_cameras()[0])
cam.start()
raw = cam.get_raw()
cam.stop()
pygame.camera.quit()

h = hashlib.sha256()
h.update(raw)
print ord(h.digest()[-1]) % 2

I like the idea, but it is dependent on a) having a light source and b) having some moving parts within the room of the camera. If one of the above is not present, the hash will always be the same. Both are assumptions listed in the question (more or less): "However, you cannot assume any sound- and lightsources to be present except those that are only avoidable with radical efforts" and "You can neither assume humans to be present nor absent". I agree the last one doesn't exclude moving objects literally, but having some moving parts in the room seems more excludable than humans.

There is no "least significant bit" in a good hash. Yeah I know what you meant

@11684, there's probably enough thermal noise etc. in the camera to prevent identical results

The light should fluctuate quite a bit (outside light going up/down, and of course any "blinkenlights" the computer probably emits)

@11684: That’s more or less what I had in mind when I wrote: “For example you can assume that the hardware is not positioned […] in an extremely […] lightproof room […]”.

This is loosely based on something a friend of mine did.  He was interested in using radioactive decay to generate truly random numbers. He dismantled a webcam and a smoke alarm, put the isotope next to the CCD, and wrote some code to feed the locations of detected beta emissions into /dev/random. However, we found that even if we sealed off all the light from the outside, there was a measurable amount of background noise on the CCD, although the beta emissions were still detectable.

https://github.com/bitplane/schrodingers-rng

Minor correction: americium 241 is an alpha emitter.

@James_pic Additional information: Doing this is illegal in many countries.

@d_r_w Do you mean the smoke alarm thing, or the webcam random number generator. Also, which countries?

The smoke alarm thing. Unsheilding the radioactive material in a smoke alarm can technically constitute a felony in the United States, for example.

@d_r_w Source on that? It doesn't sound illegal :P

@drheart Considering you can throw them to the trash https://www3.epa.gov/radtown/americium-smoke-detectors.html, it doesnt sound very likely?

Perl
Checks your Harddrive's response time, by timing three operations:

Reading its own source
Deleting itself
Writing itself again

Finally, the time taken is packed as a float, and the 11th most significant bit is used (second most significant bit of the mantissa).
use Time::HiRes qw(time);

$t1 = time;
open SELF, "<$0";
read SELF, $_, $^H;
close SELF;

unlink $0;

open SELF, ">$0";
print SELF $_;
close SELF;

print 1&unpack(xB3, pack(f, time-$t1))

A program that deletes and writes itself to the disk is something I could only imagine a perl or python programmer to do. Very cool idea!

This looks something that wouldn't touch any hardware and be deterministic when run within a VM, which is a very common scenario.

You'd want a flush to disk to make it depend on the disk instead of the cache (which is machine state, rule #2)

Bash
echo $[`sensors|sed 's/[^1-9]/+/g'`0&1]

sensors prints the current system temperatures along with the fan speed.
acpitz-virtual-0
Adapter: Virtual device
temp1:        +52.0°C  (crit = +98.0°C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        3510 RPM

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +54.0°C  (high = +86.0°C, crit = +100.0°C)
Core 0:         +51.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:         +46.0°C  (high = +86.0°C, crit = +100.0°C)

sed 's/[^1-9]/+/g' converts every zero and non-digit into plus signs, and echo $[...0&1] prints the parity of the resulting sum.
Regex and parity calculation borrowed from dennis's answer.

This answer has been awarded a special bounty for a particularly short solution (just in case, anybody wonders). It was tied with Franki’s answer by my criteria and won by lot.

Bash
(echo -en "ibase=16;";(find /proc/[0-9]*/s* -type f -maxdepth 2 ; find /sys /proc/[^0-9]* -type f) 2>&1 | xargs -n1 sha256sum  2>&1 | sha256sum | tr abcdef ABCDEF | sed 's/  -/%2/' )| bc

Uses everything, just in case...
Depends on

sensor readings of most hardware sensors (about all somehow expose their values somewhere in /sys or /proc)
number, memory layout and runtimes of all processes on the system (which may be considered "state of the system" but usually themselves depend on the timings of the hardware)
depending on the system, various values in /proc/<pid>/s* (e.g. sched/schedstat) depend on the speed of the hardware necessary to bring those processes alive.
things I might not have thought of that are available in those files too.

Runtime on my system is ~10s, but may vary a lot. Especially don't run this as root, or at least modify it to exclude /proc/kcore (unless you are willing to spend a lot of time to include the entropy contained in there, which would probably really include everything)

Shell + Wi-Fi
sudo airmon-ng start wlan0 > /dev/null && sudo dumpcap -a duration:30 -i mon0 -w out.cap > /dev/null && sha512sum out.cap | grep -c "^[0-7]" && sudo airmon-ng stop mon0 > /dev/null

Puts the wi-fi card into monitor mode, dumps 30 seconds worth of packets received (including unreadable encrypted data from neighbouring networks), takes the sha512 hash of the packet data, and returns 1 if the first letter of the hash is 0-7. Assumes that your wi-fi card is wlan0, and that you do not currently have a mon0 device.
If there are no nearby wi-fi devices, then the output will be predictable, as it will be the same every time.

Hmm, I would not count the absence of wi-fi devices so unnatural that you can neglect it.

@Wrzlprmft It depends where you are.  It is unnatural to not have wifi networks in a crowded urban area.  On a universal scale, not being in a near total vacuum is not a fair assumption, nor if limited to Earth is it fair to assume the computer is not submerged in water.

@IanD.Scott: Well, the next wifi-free area for me is actually in the cellar (don’t ask me why I know this). And I am not living in the middle of nowhere. Anyway, the number of computers in wifi-free suroundings certainly exceeds the number of (working) computers in water or a vacuum by several orders of magnitude. (It all comes down to your definition of natural in the end, I guess.)

Modern 8086 compatible processors manufactured by Intel contain an easily accessible peripheral that generates proper randomness. Driving that peripheral is done using the rdrand instruction which either generates a random bit pattern or sets the carry flag if the peripheral is unavailable or out of entropy.
The following short program for 80386 Linux checks if the peripheral is available by means of the cpuid instruction and tries to generate a random number. If either the peripheral or a random number is not available, the program will terminate with a status of 1. If a random number could be generated, either a 1 or a 0 is printed out and the program terminates with exit status 0.
Save as rand.s and assemble with
as --32 -o rand.o rand.s
ld -melf_i386 -o rand rand.o

Here is the entire assembly:
        .globl _start
        .type _start,@function
_start:
        # check if the cpuid instruction is available by trying to
        # toggle the id flag in the eflags register
        pushfl
        mov (%esp),%eax
        btc $21,%eax    # toggle id bit
        push %eax
        popfl           # check if id bit was saved
        pushfl
        pop %eax        # load new flags
        pop %ecx        # load original flags
        xor %ecx,%eax   # difference is in %eax
        bt $21,%eax     # check if bit was flipped
        jnc .Lfailure

        # if we reach this part, we have a cpuid instruction
        # next, check if rdrand exists
        mov $1,%eax     # load cpuid leaf 1
        cpuid
        bt $30,%ecx     # is rdrnd available?
        jnc .Lfailure

        # let's try to get some random data
        rdrand %ax      # don't waste randomness; one bit would suffice
        jnc .Lfailure   # no randomness available
        and $1,%eax     # isolate one bit of randomness
        add $0x30,%al   # 0x30 = '0'
        push %eax
        mov $4,%eax     # prepare a write system call
        mov $1,%ebx
        mov %esp,%ecx   # where we placed the data before
        mov %ebx,%edx   # one byte
        int $0x80

        # okay, we're done here. Let's exit
        mov %ebx,%eax   # do an exit system call with status 0
        xor %ebx,%ebx
        int $0x80

.Lfailure:
        mov $1,%eax     # do an exit system call with status 1
        mov %eax,%ebx
        int $0x80

        .size _start,.-_start

And a dump of the resulting 77 bytes of machine code:
08048098 <_start>:
 8048098:   9c                      pushf
 8048099:   8b 04 24                mov    (%esp),%eax
 804809c:   0f ba f8 15             btc    $0x15,%eax
 80480a0:   50                      push   %eax
 80480a1:   9d                      popf
 80480a2:   9c                      pushf
 80480a3:   58                      pop    %eax
 80480a4:   59                      pop    %ecx
 80480a5:   31 c8                   xor    %ecx,%eax
 80480a7:   0f ba e0 15             bt     $0x15,%eax
 80480ab:   73 2f                   jae    80480dc <_start+0x44>
 80480ad:   b8 01 00 00 00          mov    $0x1,%eax
 80480b2:   0f a2                   cpuid
 80480b4:   0f ba e1 1e             bt     $0x1e,%ecx
 80480b8:   73 22                   jae    80480dc <_start+0x44>
 80480ba:   66 0f c7 f0             rdrand %ax
 80480be:   73 1c                   jae    80480dc <_start+0x44>
 80480c0:   83 e0 01                and    $0x1,%eax
 80480c3:   04 30                   add    $0x30,%al
 80480c5:   50                      push   %eax
 80480c6:   b8 04 00 00 00          mov    $0x4,%eax
 80480cb:   bb 01 00 00 00          mov    $0x1,%ebx
 80480d0:   89 e1                   mov    %esp,%ecx
 80480d2:   89 da                   mov    %ebx,%edx
 80480d4:   cd 80                   int    $0x80
 80480d6:   89 d8                   mov    %ebx,%eax
 80480d8:   31 db                   xor    %ebx,%ebx
 80480da:   cd 80                   int    $0x80
 80480dc:   b8 01 00 00 00          mov    $0x1,%eax
 80480e1:   89 c3                   mov    %eax,%ebx
 80480e3:   cd 80                   int    $0x80

“You may use any […] hardware […] – unless it is intended for random-number generation.” – The goal is to improvise a hardware random-number generator, not to use one.

@Wrzlprmft rdrand is not a random number generator. It's a peripheral made for the NSA to mess with people's cryptography.

Actually, I didn't notice that sentence before writing this program. My bad.

bash
Aiming for the most unnecessarily expensive random number gathering method. Time how long it takes to spawn emacs a million times, then use Dennis' trick to turn the time taken into a single Boolean (takes about 7 seconds on my machine).
$[`(time (seq 1000000 | xargs -P1000 emacs  >/dev/null 2>&1)) |& sed 's/[^1-9]/+/g'`0&1]

with averaging, the deviation can be very small…

Arduino Mega1280
edit: updated version that is robust against having anything plugged into the pins. The idea relies on the fact that the ATMega1280 uses a separate internal oscillator for the watchdog oscillator. I simply setup a watchdog interrupt which sets a flag, have a counter based on the system clock (on the Arduino this is a 16MHz external crystal), and allow clock jitter/variance do the work.
#include <avr/interrupt.h>

int time;
volatile bool wdt_ran;

// watchdog interrupt handler
ISR(WDT_vect, ISR_BLOCK)
{
  wdt_ran = true;
}

void setup()
{
  // setup watchdog interrupt
  cli();
  MCUSR &= ~(1 << WDRF);
  WDTCSR |= (1<<WDCE) | (1<<WDE);
  WDTCSR = (1<<WDIE) | (1<<WDP2) | (1<<WDP1) | (1<<WDP0);
  sei();
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
}

void loop()
{
  if(wdt_ran)
  {
    Serial.println(abs(time%2));
    wdt_ran = false;
  }
  ++time;
}

Javascript
http://jsfiddle.net/prankol57/9a6s0gmv/
Takes video input.
You can see the screenshot that it used to calculate the random number.
var m = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);

var constraints = {
  video: {
    mandatory: {
      maxWidth: 350,
      maxHeight: 350
    }
  },
  audio: false
};

var video = document.querySelector("video"), canvas = document.createElement("canvas");
document.body.appendChild(canvas);
canvas.width = 350;
canvas.height = 350;

function start() {
    m.call(navigator, constraints, function (stream) {
        video.src = window.URL.createObjectURL(stream);
    }, function() {
        alert("An error occured. Did you deny permission?");
    });
}

if (m) {
    start();
} else {
    alert('getUserMedia() is not supported in your browser');
}

function getRandomData() {
    var ctx = canvas.getContext("2d");
    ctx.drawImage(video, 0, 0);
    var data = ctx.getImageData(0, 0, 350, 350).data;
    var total = 0;
    for (var i = 0; i < data.length; ++i) {
        total += data[i];
        total %= 2;
    }
    alert("The random number is " + total);
}

document.querySelector("button").onclick = getRandomData;

I just found a bug in FF, "Stop sharing" doesn't turn of the webcam!

Shell on Linux
Measure read speed of a hard drive + access time of a frequently updated directory on this disc which layout is unpredictable.
# Set this to the device node of whatever drive you want to measure
DRIVE_DEVICE=sda
# This must be a path that is
# a) on device "/dev/$DRIVE_PATH"
# b) frequently updated to add additional access time randomization due to
#    less-predictable disk layout due to less-predictable time, amount and
#    ordering uf updates, like logfile directories, maybe cache directories.
FIND_PATH=/var/log
# Better than using 'sync' - sync only the disk that we actually read from
# also sync both internal drive and system buffers
hdparm -f -F "/dev/$DRIVE_DEVICE"
# Note: bash's built-in time command doesn't support formats :/
# Note: the result is only going to be as good as the system's time command,
#       which isn't necessarily equally good on other U*ICes
t=$(command time -f '%e' -- find "$FIND_PATH" -printf '' 2>&1)
echo $((${t#*.}&1))

requires:
1) read and execute access to every directory under "$FIND_PATH"
2) sending (flush) control commands to a hard drive via a device node.
   Requires root access per default, but can be delegated to a less privileged user
   either by using sudo on this script or by applying
       chgrp 'some_system_group' "$DRIVE_DEVICE" &&
       chmod g+rx "$DRIVE_DEVICE"
   if this is acceptable on your system.

This approach has the advantage of not modifying any data on the system and not requiring perl over primo's one.

Shell
Tested on Linux, but maybe your U*IX does have /proc/stat as well?
This starts only a single additional process, reads only a single additional file (not even on disc) and is 37 characters short. It's also pretty fast.
t=1`sum /proc/stat`;echo $[${t% *}&1]

One may think that this is determined by all kernel and userland process states, but that is not the case, since /proc/stat also includes IO-wait time, time to sevice hardware interrupts, time spent in idle task and some other which all depend on external hardware input.

This answer was tied for the bounty for a particularly short answer by my criteria and lost by lot.

Matlab
The microphone solution:
recObj=audiorecorder;recordblocking(recObj,10);rem(sum(getaudiodata(recObj)<0),2)

Records 10 seconds of sound, finds the number of negative samples in the recording and outputs 0 if this number is even and 1 if it's odd. Thus 0 with 50% probability.
The approach means that even small amounts of noice, unavoidable in a silent recording, will be enough to generate a random output. The following slightly longer code speeds up the number generator by using a shorter recording, compensated with a higher bitrate, which gives more noise.
recObj=audiorecorder(8000,16,1);recordblocking(recObj,0.1);rem(sum(getaudiodata(recObj)<0),2)

In a test under quiet conditions, I find that in 100 runs of the latter code, the code outputs zero 51 times. 100 runs under noisy conditions produced zero 40 times.
Edit: Thanks to Emil for pointing out a flaw in the original code :-)

What happens if the record is not silent and there are no non-zero samples?

Good question. Some zeros tend to pop up anyway, because the values oscillate around zero (sound vibrations) and there's a limited number of decimals. But now that you mention it, it should of course be "<0" rather than ~=0, so that I count the number of negative samples instead. :-] This too is random.

Bash
(Thanks, Dennis.)
echo $[`w|sed 's/[^1-9]/+/g'`0&1]

If I am not fully mistaken, this only relies only on the system time and the current software state of the computer and moreover requires a user to be logged in.

@Wrzlprmft: w shows a list of logged in users, which can be empty. The system load is based on the CPU queue length.

Well, I could replace w with top.

Takes the least significant bit of the computer's accelerometer (needs the hdaps Linux module):
#!/usr/bin/env python
import re
m = re.search('([-\d]+),([-\d]+)',
              open('/sys/devices/platform/hdaps/position', 'r').read())
print((int(m.group(1)) ^ int(m.group(2))) & 1)

This basically measures the noise of the sensor.

SmileBASIC
XON MOTION 'enable motion sensor
ACCEL OUT ,,Z 'get Z acceleration (up/down)
PRINT Z<-1 'if Z is less than -1, output 1, otherwise 0.

Uses the 3DS's motion sensor.
The Z axis of the accelerometer is usually around -1 (because of gravity), and due to random noise, it can sometimes be above or below that.
Here's one that uses the microphone:
XON MIC 'enable microphone
DIM REC%[0] 'make array
MICSTART 0,3,1 'start recording. 0=8180Hz, 3=8 bit unsigned, 1=1 second
WAIT 1 'delay (1 frame is enough since we only check the first sample)
MICSAVE MIC 'save recording
PRINT MIC[0]>0 'if the first sample isn't negative, output 1

Bash
I took Soham’s own suggestion (using top):
echo $[`top -bn1|sed 's/[^1-9]/+/g'`0&1]

Edit: It works the same way Soham's does. It turns all non numeric characters in the output of top into '+' and then evaulates the parity of the resulting string.
the 'b' flag to top runs it in batch mode so that it reports all processes, not just the first screenful and 'n1' says to just run 1 iteration of top.

Is there really any difference between your and Soham's program?

source: Stack Exchange

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

sort: votes


text:
Combinatorial products of unique primes
Statement of problem
Given a set of unique, consecutive primes (not necessarily including 2), generate the products of all combinations of first powers of these primes — e.g., no repeats — and also 1. For example, given the set { 2, 3, 5, 7 }, you produce { 1, 2, 3, 5, 6, 7, 10, 14, 15, 21, 30, 35, 42, 70, 105, 210 } because:
  1  =  1
  2  =  2
  3  =  3
  5  =  5
  6  =  2 x 3
  7  =  7
 10  =  2 x 5
 14  =  2 x 7
 15  =  3 x 5
 21  =  3 x 7
 30  =  2 x 3 x 5
 35  =  5 x 7
 42  =  2 x 3 x 7
 70  =  2 x 5 x 7
105  =  3 x 5 x 7
210  =  2 x 3 x 5 x 7

Note that if the cardinality of your input set is k, this will give you 2^k members in your output set.
Rules/Conditions

You can use any language. Aim for the smallest character count of source code.
Your solution must be either a complete program or a complete function. The function can be anonymous (if your language supports anonymous functions).
Your solution should be able to support products up to at least 2^31. Don't worry about detecting or handling integer overflow if you are passed numbers whose product is too great to represent. However, please state the limits of your calculations.
You may accept either a list or a set and produce either a list or a set. You may assume the input is sorted but you are not required to produce sorted output.

Background
When or why is this useful? One place it is very useful is in generating a table of multipliers to race in parallel in an integer factoring algorithm known as Square Forms Factorization. There, each odd multiplier you try decreases the probability of the algorithm failing (to find a factor) by approximately 50% on hard semiprimes. So with the set of generating primes { 3, 5, 7, 11 }, which produces a set of 16 trial multipliers to race in parallel, the algorithm fails approximately 2^–16 of the time on hard semiprimes. Adding 13 to the primes list produces a set of 32 trial multipliers, reducing the chance of failure to approximately 2^–32, giving a drastic improvement in outcome at no additional computational expense (because even with twice as many multipliers racing in parallel, on average it still finds the answer in the same total number of steps).

Pure Bash, 32 bytes
eval echo \$[{1,${1// /\}*{1,}}]

Reads input list (single space separated) passed as a command-line arg.
Three different shell expansions are used:

${1// /\}*{1,} is a parameter expansion that replaces spaces in 2 3 5 7 with }*{1, to give 2}*{1,3}*{1,5}*{1,7.  \$[{1, and }] are added to the start and end respectively to give \$[{1,2}*{1,3}*{1,5}*{1,7}].  The \$[ is backslash-escaped to prevent attempts to do arithmetic expansion at this stage.
\$[{1,2}*{1,3}*{1,5}*{1,7}] is a brace expansion.  Because brace expansion typically happens before parameter expansion, we use have to useeval to force the parameter expansion to happen first.  The result of the brace expansion is $[1*1*1*1] $[1*1*1*7] $[1*1*5*1] ... $[2*3*5*7].
$[1*1*1*1] $[1*1*1*7] $[1*1*5*1] ... $[2*3*5*7] is a list of arithmetic expansions, which are then evaluated to give the list of numbers we require.

Output:
$ ./comboprime.sh "2 3 5 7"
1 7 5 35 3 21 15 105 2 14 10 70 6 42 30 210
$

Mind...blown...wow!

Wtf... i get 1 0

@username.ak What is your input?  How are you inputting it (command-line args?).  What version of bash are you running? bash --version

CJam, 13 bytes
1aq~{1$f*+}/p

Reads an array (e.g., [2 3 5 7]) from STDIN. Try it online.
An anonymous function would have the same byte count:
{1a\{1$f*+}/}

Example run
$ cjam <(echo '1aq~{1$f*+}/p') <<< '[]'
[1]
$ cjam <(echo '1aq~{1$f*+}/p') <<< '[2 3 5 7]'
[1 2 3 6 5 10 15 30 7 14 21 42 35 70 105 210]

How it works
1a               " Push R := [1].              ";
  q~             " Read an array A from STDIN. ";
    {     }/     " For each a ∊ A:             ";
     1$f*+       "     R += { ra : r ∊ R }     ";
            p    " Print.                      ";

Wow, that's a clever way to iterate through all subsets.

Haskell, 22
the solution is an anonymous function:
map product.mapM(:[1])

example usage:
*Main> map product.mapM(:[1]) $ [2,3,5]
[30,6,10,2,15,3,5,1]

explanation:
(:[1]) is a function which given a number x returns the list [x,1].
mapM(:[1]) is a function which given a list of numbers maps the function (:[1]) over them, and returns every possible way to choose an element from every list. for example, mapM(:[1]) $ [3,4] first maps the function to get [[3,1] , [4,1]]. then the possible choices are [3,4] (choosing the first number of both) [3,1] [1,4] and [1,1] so it returns [[3,4],[3,1],[1,4],[1,1]].
then map product maps over all choices and returns their products, which are the wanted output.
this function is polymorphic in its type meaning that it can operate on all types of numbers. you could input it a list of Int and the result would be a list of Int but could also be applied on a list of type Integer and return a list of Integer. this means that overflow behavior is not specified by this function but by the input's type (yay Haskell's expressive type system :) )

Nice! Are there any limits to the number size?

@ToddLehman nope. The default numeric type is Integer, which is an unlimited integer type. There's also Int, a 32-bit integer, but that's mostly just a legacy thing.

@JanDvorak in practice yes but I love the type system too much to not mention it :). another thing to notice is that because it's anonymous it matters how you use it because the monomorphism restriction may apply in some cases.

Mathematica, 18 17 bytes
1##&@@@Subsets@#&

That's an anonymous function. Call it like
1##&@@@Subsets@#&[{2,3,5,7}]

And Martin swoops in with a beautiously short answer!

@ToddLehman Now let's wait for the J answer that beats this one. ;)

If Mathematica wasn't closed source, somebody could write a golfed version. ×@@@@# should be unbeatable.

@Dennis The Wolfram Language specification is available independently of Mathematica and I think there are one or two (incomplete) open source implementations. Creating a Unicode-aliased version of Mathematica has been suggested a few times, but I don't think it would be very well received on PPCG. ^^

As long as no more than 256 characters are used, I don't see any problems with it. I'd call it WPL. :P

@Dennis: A golfed version of Python/Sage with some modules imported would allow for something similar: In Sage I can already do f=lambda A:map(prod,Combinations(A)) without importing anything. Just imagine this with a more concise lambda operator and one-letter functions.

@Wrzlprmft wow I never thought of that this way. A functional golfing language would be so much better at golfing than stack oriented languages. But martin was right - this isn't a good idea because it will just annoy everyone. Too bad...

@proudhaskeller: Well, you have to carefully think about how to spend your characters unless you allow for unicode variable names and similar. It’s not that easy.

@MartinBüttner Apologies for making you wait: (*/@#~2#:@i.@^#) 16 characters in J ;)

Update: C (function  f), 92
Even as a function, this is still the longest entry here. It's the first time I've passed an array of unknown length as a function argument in C, and apparently there is no way for a C function to know the length of an array passed to it, as the argument is passed as a pointer (regardless of the syntax used). Hence a second argument is required to indicate the length.
I kept the output to stdout, because setting up an integer array and returning it would almost certainly be longer.
Thanks to Dennis for the tips.
See the function f (92 characters excluding unnecessary whitespace) in the test programs below.
Output via printf
j;

f(int c,int*x){
  int p=1,i;
  for(i=c<<c;i--;p=i%c?p:!!printf("%d ",p))p*=(i/c>>i%c)&1?1:x[i%c];
}

main(int d,char**v){
  d--;
  int y[d];
  for(j=d;j--;)y[j]=atoi(v[j+1]);
  f(d,y);
}

Output via array pointer
j,q[512];

f(int c,int*x,int*p){
    for(int i=-1;++i-(c<<c);p[i/c]*=(i/c>>i%c)&1?1:x[i%c])i%c||(p[i/c]=1);
}

main(int d,char**v){
  d--;
  int y[d];
  for(j=d;j--;)y[j]=atoi(v[j+1]);
  f(d,y,q);
  for(j=1<<d;j--;)printf("%d ",q[j]);
}

C (program),108
excluding unnecessary whitespace.
p=1,i;
main(int c,char**v){
  c-=1;
  for(i=c<<c;i--;i%c||(printf("%d ",p),p=1))(i/c>>i%c)&1||(p*=atoi(v[i%c+1]));
}

Input from commandline, output to stdout. C isn't going to win here, but maybe I will try converting to a function tomorrow.
Basically we iterate through all 1<<c combinations of primes, with each bit of i/c being associated with the presence or absence of a particular prime in the product. The "inner loop" i%c runs through the primes, multiplying them according to the value of i/c. When i%c reaches 0, the product is output, then set to 1 for the next "outer" iteration.
curiously, printf("%d ",p,p=1) does not work (it always prints a 1.)  This is not the first time I have seen odd behaviour when a value is used in a printf and assigned later in the same bracket. It is possible in this case that the second comma is not being treated as an argument separator, but rather as an operator.
Usage
$ ./a 2 3 5 7
1 2 3 6 5 10 15 30 7 14 21 42 35 70 105 210

C doesn't rigorously define the order that arguments are evaluated in. In particular, many C function calls have arguments evaluated from right to left.

From section 6.5.2.2 of ISO/IEC 9899:TC3: The order of evaluation of the function designator, the actual arguments, and subexpressions within the actual arguments is unspecified[.] So, it is up to the compiler in which order a function's arguments are evaluated. With -Wsequence-point or -Wall, GCC will complain.

You can change c-=1 to c-- or even use i=--c<<c if you don't mind UB (it seems to work with GCC). 2. Both uses of || can be replaced with ternary operators: p=i%c?p:!!printf("%d ",p) and p*=(i/c>>i%c)&1?1:atoi(v[i%c+1])

@Dennis Thanks for the tips! I posted just before bed so I'd just got the program running. c-=1 is such basic golfing I shouldn't have missed it, but it was a quick bug fix because I'd forgotten that there's one extra string in  argv (the program name.) i=..c<<c works on GCC/cygwin, but I've left my original program as it is and moved on to a function. So I've just learned that sizeof doesn't work on arrays passed as function arguments. I've incorporated your suggestions for ternary operators into the function. I've stuck with output to stdout as I see no short way to return an array.

Yes, arrays passed as function arguments decay to pointers. -- It is not uncommon in C to pass a pointer to the array that should contain the results as a function parameter. The question says that you can assume that the products are smaller than 2^31, so you can just pass an array of size 512.

Python: 55 chars
f=lambda l:l and[x*l[0]for x in f(l[1:])]+f(l[1:])or[1]

Recursively generates the products by choosing to include or exclude each number in turn.

Recursive solution! Cool!

I think you can drop the space after and if you write the sum the other way around?

@mathmandan Yup, that works, thanks.

Haskell, 27 bytes
This is a Haskell implementation of @sudo's CJam answer as an anonymous function. It won't beat the awesome Haskell solution of @proud haskeller, but I'll drop it here anyway.
foldr((=<<)(++).map.(*))[1]

Explanation: foldr takes in a binary function, a value, and a list. Then it replaces each cons cell in the list by an application of the function, and the end of the list by the value, like this: foldr f v [a,b,c] == f a (f b (f c v)). Our value is a one-element list containing 1, and the binary function is f = (=<<)(++).map.(*). Now, f takes a number n, makes a function (n*) that multiplies by n, makes from it a function g = map(n*) that applies that function to all elements of a list, and feeds that function to (=<<)(++). Here, (++) is the concatenation function, and (=<<) is monadic bind, which in this case takes in (++) and g, and gives a function that takes in a list, applies g to a copy of it, and concatenates the two.
In short: start with [1], and for each number n in the input list, take a copy of the current list, multiply everything by n, and append it to the current list.

PARI/GP, 26 bytes
v->divisors(factorback(v))

Longer versions include
v->divisors(prod(i=1,#v,v[i]))

(30 bytes) and
v->divisors(fold((x,y)->x*y,v))

(31 bytes).
Note that if the input was a factorization matrix rather than a set, 18 bytes could be saved using divisors alone. But converting a set to a factorization matrix seems to take more than 18 bytes. (I can do it in 39 bytes directly as v->concat(Mat(v~),Mat(vectorv(#v,i,1))) or 24 bytes by multiplying and re-factoringv->factor(factorback(v)), can anyone do better?)

Sage – 36 34
Essentially, the same as Martin Büttner’s solution, if I understand it correctly. As I mentioned it in a comment, I might as well post it as an answer.
lambda A:map(prod,Combinations(A))

This is an anonymous function, which can for example be called as follows:
(lambda A:map(prod,Combinations(A)))([2,3,5,7])

You could shave 2 bytes by making it an anonymous function (it is allowed by the question)

J (20)
This turned out longer than I hoped or expected.Still: shorter than haskel!
*/@:^"1#:@i.@(2&^)@#

Usage:
    f=:*/@:^"1#:@i.@(2&^)@#
    f 2 3 5 7
1 7 5 35 3 21 15 105 2 14 10 70 6 42 30 210

This works for any set of numbers, not just primes. Also, the primes can be of unlimited size, as long as the array has the postfix x: 2 3 5 7x

*/@#~2#:@i.@^# is an alternative for 14 bytes.

05AB1E, 2 bytes
æP

Try it online!
Explanation
æ   # powerset
 P  # product

R, 56 bytes
r=1;for(i in 1:length(s))r=c(r,apply(combn(s,i),2,prod))

I'm considering here that s is the set (and a list).
I'm sure it can be made even shorter. I'll see.

PHP, 97 Bytes
<?for(;$i++<array_product($a=$_GET[a]);){$t=$i;foreach($a as$d)$t%$d?:$t/=$d;if($t<2)echo"$i\n";}

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


text:
Find smallest period from a >1000 digit number
Your job is to take this number as input (although it should work with any other number too):
18349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957

and find the smallest period, which is in this case:
1834957034571097518349570345710975183495703457109751834957034571097518349570345710976

Good luck and have fun!

Clarifications:

The input number has in minimum one period and one partial period
The period always starts at the beginning of the input number
Period means in this case a sequence of numbers which repeats itself.

what is the maximum size of the input number? if you meant 1000 is the maximum size, your > is facing the wrong way.

@steveverrill: No, there is no maximum size of the input number per se, but let's limit it to 2^16 digits (because you asked).

What is a period?

@FUZxxl in this case: a sequence of numbers which repeats itself.

@MichaelBolli Thank you for the explanation.

What you're asking for is clear, but you really should not call it a period: in mathematics, a period only refers to digits after the decimal point repeated infinitely many times. As opposite, your test input is an integer and has a finite number of digits.

@GOTO0 thanks I will remember that in the future!

Can we assume that there will be at least 1 period in the number. By that, I mean that the number will have at least 1 period and 1 partial period .

@MartinBüttner The period always starts at the beginning of the string.

@Optimizer Yes.

CJam, 20 16 bytes
Ll:Q{+_Q,*Q#!}=;

Reads from STDIN. Try it online.
The above code will require O(n2) memory, where n is the length of the input. It will work with 216 digits, as long as you have enough memory.
This can be fixed the the cost of five extra bytes:
Ll:Q{+_Q,1$,/)*Q#!}=;

Example run
$ cjam <(echo 'Ll:Q{+_Q,*Q#!}=;') <<< 18349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957; echo
1834957034571097518349570345710975183495703457109751834957034571097518349570345710976
$ cjam <(echo 'Ll:Q{+_Q,*Q#!}=;') <<< 12345123451; echo
12345
$ cjam <(echo 'Ll:Q{+_Q,*Q#!}=;') <<< 1234512345; echo
12345
$ cjam <(echo 'Ll:Q{+_Q,*Q#!}=;') <<< 123451; echo
12345

How it works
For input Q, the idea is to repeat the first character len(Q) times and check if the index of Q in the result is 0. If it isn't, repeat the first two characters len(Q) times, etc.
L                   " Push L := [].                                                       ";
 l:Q                " Read one line from STDIN and save the result in Q.                  ";
    {        }=     " Find the first element q ∊ Q that yields a truthy value:            ";
     +              "   Execute L += [q].                                                 ";
      _Q,*Q#        "   Push (L * len(Q)).index(Q).                                       ";
            !       "   Compute the logical NOT of the index.                             ";
               ;    " Discard the last q. This leaves L on the stack.                     ";

Regex (.NET flavour), 23 22 bytes
.+?(?=(.*$)(?<=^\1.*))

This will match the required period as a substring.
Test it here.
How does it work?
# The regex will always find a match, so there's no need to anchor it to
# the beginning of the string - the match will start there anyway.
.+?        # Try matching periods from shortest to longest
(?=        # Lookahead to ensure that what we've matched is actually
           # a period. By using a lookahead, we ensure that this is
           # not part of the match.
  (.*$)    # Match and capture the remainder of the input in group 1.
  (?<=     # Use a lookahead to ensure that this remainder is the same
           # as the beginning of the input. .NET lookaheads are best
           # read from right to left (because that's how they are matched)
           # so you might want to read the next three lines from the
           # bottom up.
    ^      # Make sure we can reach the beginning of the string.
    \1     # Match group 1.
    .*     # Skip some characters, because the capture won't cover the
           # entire string.
  )
)

This only works if the period starts at the beginning of the string, though. That happens to be the case here, but I don't see this in the specs. Right?

@TimPietzcker See OP's comment/edit on the question: the period always starts at the beginning of the string.

Regex Storm .Net seems to handle .NET as well, and it doesn't require Silverlight (unavailable on most platforms).

@Dennis Thanks, I didn't know that one!

I can't get the perl version quite right: $_ = <>; /^(.+?)(?=\g1+)/; print $1; gives 18349570345710975

@tolos That's because you don't ensure that you can reach the end of the string like this. Hence it will just use the first thing that repeats at all. E.g. aabaabaab will probably match a because it repeats. I haven't found a way to solve it in PCRE yet. Dennis tried in a now deleted answer, but that one didn't fully work either. Btw, you don't need g.

Python 60
s is the string of digits
[s[:i]for i in range(len(s))if(s[:i]*len(s))[:len(s)]==s][0]

eg:
>>> s = '18349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349570345710975183495703457109761834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957'
>>> [s[:i]for i in range(len(s))if(s[:i]*len(s))[:len(s)]==s][0]
'1834957034571097518349570345710975183495703457109751834957034571097518349570345710976'

Pyth, 14 characters
hf}z*lzTm<zdUz

Explanation:
implicit:      z = input()
h              head(
 f                  filter(lambda T:
  }z                                z in
    *lz                                  len(z) *
       T                                          T,
  m                        map(lambda d:
   <zd                                  z[:d],
   Uz                                   range(len(d)))))

Essentially, it generates all of the initial sequences of the input, repeats each one len(z) times, and sees whether z, the input, lies within the resultant string.

This is not a valid answer, but a feature was recently added to Pyth, after the question was asked, that allows a 12 character solution:
<zf}z*lz<zT1

This uses the filter on integer feature.

Japt, 8 bytes
å+ æ@¶îX

Try it
-2 bytes thanks to Shaggy!
Transpiled JS Explained:
// U is the input string representation of the number
U
 // cumulative reduce using the '+' operator
 // the result is an array of strings length 1, 2, ..., N
 // all substrings start with the first character from input
 .å("+")
 // find the first match
 .æ(function(X, Y, Z) {
  // repeat the substring until it is as long as the input
  // and compare it to the input
  return U === U.î(X)
 })

8 bytes: å+ æ@¶îX

Excellent :) I've seen throwing an operator into the reduce function before, but forgot about it.

Java 8, 125 bytes
Takes input as a string since there is no reasonable way to represent a 1000+ digit number in Java other than a string (No BigInteger please).
s->{String o="";for(int i=0;java.util.Arrays.stream(s.split(o+=s.charAt(i++))).filter(b->!b.isEmpty()).count()>1;);return o;}

Try it online!

You can replace String with var. -3 bytes

@Adam Java 8 though

Oh, didn't see that.

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


text:
Monkey Island: The Head of the Navigator
Warning: This challenge contains some mild spoilers for The Secret of Monkey Island.
Towards the end of the game, you're being led through the catacombs by a magically preserved head of a navigator:

You need its eyeball necklace, but the Head is reluctant to give it to you. One way to get it is just to keep begging:

Guybrush: May I please have that necklace?
Head: No, but thanks for asking so politely.
Guybrush: Oh come on, pleeeeease?
Head: You can beg all you want, but you can't have it.
Guybrush: Pretty please?
Head: You can beg all you want, but you can't have it.
Guybrush: Pretty PRETTY please?
Head: You can beg all you want, but you can't have it.
Guybrush: Pretty please with sugar on top?
Head: Oh, all right, you big baby. You can have it. Hey, what good's a necklace if you don't have shoulders?

The Challenge
Write a full program which prints the above dialogue. The catch is that each time the program is called it should only print two lines (one pleading by Guybrush and the Head's response). E.g. if your submission is written in Python, usage should look like this:
$> python please.py
Guybrush: May I please have that necklace?
Head: No, but thanks for asking so politely.
$> python please.py
Guybrush: Oh come on, pleeeeease?
Head: You can beg all you want, but you can't have it.
$> python please.py
Guybrush: Pretty please?
Head: You can beg all you want, but you can't have it.
$> python please.py
Guybrush: Pretty PRETTY please?
Head: You can beg all you want, but you can't have it.
$> python please.py
Guybrush: Pretty please with sugar on top?
Head: Oh, all right, you big baby. You can have it. Hey, what good's a necklace if you don't have shoulders?

Invoking the program more than 5 times may result in undefined behaviour, so you could either loop, keep printing the last two lines or the program could even be broken after the 5th invocation.
You may write to a file in the working directory, or you can modify the source code of the program itself to keep track of invocations. In the latter case, your program must not depend its own filename. (In the former case, you can assume that your program's file name will not clash with any file names your program depends on.)
You must not assume a REPL-like environment or that any data is kept in RAM between invocations. E.g. if you answer in Mathematica, you have to assume that I quit the kernel between invocations.
This is code golf, the shortest answer (in bytes) wins. If your program depends on any additional files to exist before the first invocation, add its name and contents to your byte count.

So no putting value to global variables and then reusing in JS ?

@Optimizer Nope, sorry. I think if you want to use JS for this one, you'll have to use node.

We can have global variables in node as well. Are you suggesting that wrt node, we should be able to exit node and still continue on the dialogue sequence ?

@Optimizer Yes. You should write a full program, which I can invoke 5 times with node please.js yielding 5 different outputs.

Can my program depend on an external file to start off? I'll include its byte count in my score

@Claudiu Sounds fair to me.

Speaking of javascript, can we assume localStorage or cookies as persistent storage?

@JanDvorak Yes that should be fine, as it would allow me to kill the browser between invocations.

I sent a JS solution using localStorage FWIW :)

Python, 224 + 97 + 1 = 322 characters
A most straightforward solution to start us all off. Thanks to gnibbler for helping me shave off 18 bytes!
n=0
print open('z','rb').read().decode('zip').split('|')[n]
open(__file__,'r+').write("n="+`n+1`)

Requires the file z to be present in the same directory (+1 for filename, +224 for file size):
$ hexdump z
0000000 9c78 d1ad 6e3d 30c3 050c bde0 78a7 165b
0000010 0723 92c8 48a9 b43a 8209 192c 9b29 0491
0000020 a2ab 9fa1 021a f87a 715a f46c d100 1026
0000030 1efc 1e41 5172 4721 c3b3 1527 607c 4c70
0000040 6191 87e8 0c91 7825 7b6e 2d47 dfef 4c8e
0000050 0edd d25f e540 8b54 8fbe 4bb8 c500 7ade
0000060 288d c418 c4d9 6cae 0f7f 7bab 6832 9be5
0000070 be21 7aa9 537d c2c2 24dd 25a3 c50f e41a
0000080 ca1c 1ff4 a7c9 a439 d5cc 9a4d b207 3fe9
0000090 0e7c 529c 4e79 3afc 7cef bf79 6f5e 672f
00000a0 8b9f 6d1d 8832 5359 1698 2482 92c3 3270
00000b0 43cd 560e 899b a4ad 1ab2 548a aed9 0bf1
00000c0 238f 0697 bd63 168f 36e9 b411 0a1e fef6
00000d0 eee8 1d64 1a28 aec9 10e3 7ff7 3a0b d9ab
00000e0

$ ls -l z
-rw-r--r--+ 1 Laxori mkpasswd 224 2014-09-22 22:35 z

You can generate z with the following:
>>> open('z','wb').write("""eJyt0T1uwzAMBeC9p3hbFiMHyJKpSDq0CYIsGSmbkQSroqGfGgJ6+FpxbPQA0SYQ/B5BHnJRIUez
wycVfGBwTJFh6IeRDCV4bntHLe/fjkzdDl/SQOVUi76PuEsAxd56jSgYxNnErmx/D6t7MmjlmyG+
qXp9U8LC3SSjJQ/FGuQcyvQfyac5pMzVTZoHsuk/fA6cUnlO/DrvfHm/Xm8vZ5+LHW0yiFlTmBaC
JMOScDLNQw5Wm4mtpLIailTZrvELjyOXBmO9jxbpNhG0Hgr2/ujuZB0oGsmu4xD3fws6q9k=""".decode('base64'))

Output:
$ python monkeyisland.py
Guybrush: May I please have that necklace?
Head: No, but thanks for asking so politely.
$ python monkeyisland.py
Guybrush: Oh come on, pleeeeease?
Head: You can beg all you want, but you can't have it.
$ python monkeyisland.py
Guybrush: Pretty please?
Head: You can beg all you want, but you can't have it.
$ python monkeyisland.py
Guybrush: Pretty PRETTY please?
Head: You can beg all you want, but you can't have it.
$ python monkeyisland.py
Guybrush: Pretty please with sugar on top?
Head: Oh, all right, you big baby. You can have it. Hey, what good's a necklace if you don't have shoulders?
$ python monkeyisland.py
Traceback (most recent call last):
  File "monkeyisland.py", line 2, in <module>
    print open('z','rb').read().decode('zip').split('|')[n]
IndexError: list index out of range

Use a different delimiter for between the pairs of lines, so for example you have line1\nline2|line3\nline4|line5\nline6|line7\nline8|line9\nline10 Now you can split on | and just print D[n]

@gnibbler: Well spotted sir!

Common Lisp (SBCL) : 659 characters
(defparameter *d*
  '#1=("~A May I please have that necklace?"
       "~A No, but thanks for asking so politely."
       "~A Oh come on, pleeeeease?"
       #2="~A You can beg all you want, but you can't have it."
       "~A Pretty please?"
       #2#
       "~A Pretty PRETTY please?"
       #2#
       "~A Pretty please with sugar on top?"
       "~A Oh, all right, you big baby. You can have it. Hey, what good's a necklace if you don't have shoulders?" . #1#))
(defun d ()
  (format t (pop *d*) "Guybrush:") (terpri)
  (format t (pop *d*) "Head:") (terpri)
  (terpri)
  (finish-output)
  (sb-ext:save-lisp-and-die "please" :toplevel 'd :executable t))
(d)

Explanations

I dump the lisp image after each invocation, which saves current state.
The circular list let me restart the dialogue after all lines have been displayed (not required, but at least it doesn't error on format with nil).
Reader macros allow me to reuse some identical lines.

This won't be the shortest submission, but I thought this was a nice approach to the problem.
Firt invocation
 $sbcl --noinform --noprint --load please.lisp
 Guybrush: May I please have that necklace?
 Head: No, but thanks for asking so politely.

 [undoing binding stack and other enclosing state... done]
 [saving current Lisp image into please:
 writing 5856 bytes from the read-only space at 0x0x20000000
 writing 4032 bytes from the static space at 0x0x20100000
 writing 67960832 bytes from the dynamic space at 0x0x1000000000
 done]

Subsequent invocations
$./please
Guybrush: Oh come on, pleeeeease?
Head: You can beg all you want, but you can't have it.

[undoing binding stack and other enclosing state... done]
[saving current Lisp image into please:
writing 5856 bytes from the read-only space at 0x0x20000000
writing 4032 bytes from the static space at 0x0x20100000
writing 68091904 bytes from the dynamic space at 0x0x1000000000
done]

$./please
Guybrush: Pretty please?
Head: You can beg all you want, but you can't have it.

[undoing binding stack and other enclosing state... done]
[saving current Lisp image into please:
writing 5856 bytes from the read-only space at 0x0x20000000
writing 4032 bytes from the static space at 0x0x20100000
writing 68091904 bytes from the dynamic space at 0x0x1000000000
done]

C# - 593 + 1 + 1 Characters (595)
Edits: Updated with suggestions from Martin and various other optimisations
First +1 is a filename. Second +1 is contents of that file. Without all the spaces and line breaks removed so you can read it:
using System.IO;
using s=System.String;
class P
{
    static void Main()
    {
        s g="Guybrush: ",h="Head: ",p=" please",q="Pretty";
        s[]b=new s[]{"May I"+p+" have that necklace","No, but thanks for asking so politely.",
        "Oh come on, pleeeeease","You can beg all you want, but you can't have it.",q+p,
        "Oh, all right, you big baby. You can have it. Hey, what good's a necklace if you don't have shoulders?",
        q+" PRETTY"+p,"",q+p+" with sugar on top"};
        int a=int.Parse(File.ReadAllText("x",System.Text.Encoding.UTF8));
        System.Console.WriteLine(g+b[a]+"?\n"+h+b[(a+5)/6*2+1]);
        File.WriteAllText("x",(a+2).ToString());
    }
}

Explanation
Relies on a text file called "x" to be present in the directory. Should initially contain a zero and is used to store progress.
Program plucks relevant element out of the string array according to progress and writes progress at end. Some lines reused to shorten length, hence index selection logic h+b[(a+5)/6*2+1] for answer selection.
Output
D:\Projects\Junk\MI\bin\Debug>MI
Guybrush: May I please have that necklace?
Head: No, but thanks for asking so politely.

D:\Projects\Junk\MI\bin\Debug>MI
Guybrush: Oh come on, pleeeeease?
Head: You can beg all you want, but you can't have it.

D:\Projects\Junk\MI\bin\Debug>MI
Guybrush: Pretty please?
Head: You can beg all you want, but you can't have it.

D:\Projects\Junk\MI\bin\Debug>MI
Guybrush: Pretty PRETTY please?
Head: You can beg all you want, but you can't have it.

D:\Projects\Junk\MI\bin\Debug>MI
Guybrush: Pretty please with sugar on top?
Head: Oh, all right, you big baby. You can have it. Hey, what good's a necklace
if you don't have shoulders?

D:\Projects\Junk\MI\bin\Debug>

My first code golf, probably not the shortest possible in C# but hey - Monkey Island, couldn't resist!
Stripped code:
using System.IO;using s=System.String;class P{static void Main(){s g="Guybrush: ",h="Head: ",p=" please",q="Pretty";s[]b=new s[]{"May I"+p+" have that necklace","No, but thanks for asking so politely.","Oh come on, pleeeeease","You can beg all you want, but you can't have it.",q+p,"Oh, all right, you big baby. You can have it. Hey, what good's a necklace if you don't have shoulders?",q+" PRETTY"+p,"",q+p+" with sugar on top"};int a=int.Parse(File.ReadAllText("x",System.Text.Encoding.UTF8));System.Console.WriteLine(g+b[a]+"?\n"+h+b[(a+5)/6*2+1]);File.WriteAllText("x",(a+2).ToString());}}

Welcome to PPCG! A few golfing tips: I think you can simplify that ternary operator a bit. At least to a<1?1:a<8?3:9, if C# supports truthy integers, then also a?a<8?3:9:1. But you can probably even make use of integer division and do (a+5)/6*2 and move the final string of the head to replace the first empty one (index 5). And try stuff like using s=System.String;. (Oh and you might be able to omit the namespace, or even use namespace System to avoid System in all the using.)

So I can. All this learning to code for maintainability is really putting me at a disadvantage here ;)

JS, 488 473
Refreshing 5 times the page containing this code displays the 5 different dialogs.
l=localStorage;a="
Guybrush: ";b=a+"Pretty please";d="
Head: ";c=d+"You can beg all you want, but you can't have it.";document.write(a+"May I please have that necklace?"+d+"No, but thanks for asking so politely."+a+"Oh come on, pleeeeease?"+c+b+"?"+c+a+"Pretty PRETTY please?"+c+b+" with sugar on top?"+d+"Oh, all right, you big baby. You can have it. Hey, what good's a necklace if you don't have shoulders?


text:
5 Seconds to Find Pie
Pi times e (or Pie if you like ambiguous notation) to 100 decimal places is:
8.5397342226735670654635508695465744950348885357651149618796011301792286111573308075725638697104739439...

(OIES A019609) (argument for possible irrationality)
Your task is to write a program that takes in a positive integer N, and outputs Pi*e truncated to N decimal places. e.g. if N = 2, then the output should be 8.53.
This is an optimization problem, so the submission that can give the correct output for the highest value of N will win.
To ensure all submissions are judged using the same computing power, your code must be run on ideone, using any language they support. According to the ideone faq, there is a 5 second run time limit for not logged in users. This 5 second limit is the one you must use, not the 15 second limit for logged in users. (See faq for other limits like memory, code size, etc.)
Specifically, anyone not logged into ideone should be able to run your program on ideone for all values of N from 1 to some maximum Nmax, and see correct output nearly all of the time. without any Time limit exceeded or Memory limit exceeded, etc. errors. The submission with the largest Nmax wins.
(Whether the actual time taken is a smidge over 5 seconds doesn't matter as long as ideone doesn't give errors. "Nearly all of the time" is defined as more than 95% of the time for any particular N.)
Details

You may use any mathematical method you like to calculate Pie, **but you may not hardcode the output beyond the first dozen digits of Pi, e or Pie**.

Your program should be able to work for any N, given unlimited resources.
You may use built in Pi or e constants if your language happens to have them.

You may not access websites or resources external to your code (if ideone even allows this).
Beyond hardcoding and accessing external resources, anything that ideone allows is almost certainly fine.
Your input and output must (obviously) work with whatever ideone provides for i/o (stdin/stdout only it seems). It's fine if you need quotes around the input N or the output is something like ans = ..., etc.
Please include a link to an ideone snippet of your code with your Nmax as input.
If there happens to be a tie (only likely if multiple submissions hit the 64kB output character limit) the highest votes answer wins.

Mmm... ambiguous pie.

This can very easily be a code-golf and would rather be more fun if it is.

@Optimizer It could be code-golf but then it would be pretty much like every other digit generation code-golf. I wanted to try a time based contest that could be verified online. (Though a more computationally complex problem might have been better.)

if this is code golf APL would probably win (minus the arbitrary precision part)

Just to make sure, you want truncated to N d.p. not rounded to N d.p.?

@TwiNight Yes, that's why I said truncated.

@TwiNight Or Mathematica: N[Pi*E,n]

I suspect that these programs will be entirely IO bound trying to write out the digits to stdout.  Five seconds is a long time to something like y-cruncher.

The restriction for ideone and allowing constants but not hardcoding both make this challenge not so good IMO, -1

I've done some exploring.  Because ideone's Python doesn't have gmpy2, Python is at a shocking disadvantage.  A Python recipe to compute pi can do 8000 digits in 5 seconds on my laptop, and 3000000 digits if the python code uses gmpy2.  This is an exercise in implementing arbitrary precision math efficiently, and not much more.

@Will Mind sharing that recipe? The best I've got barely manages 1000000 in 5s.

Python - 65535
http://ideone.com/knKRhn
from math import exp, log

def divnr(p, q):
  """
    Integer division p/q using Newton-Raphson Division.
    Assumes p > q > 0.
  """

  sp = p.bit_length()-1
  sq = q.bit_length()-1
  sr = sp - sq + 1

  s = []
  t = sr
  while t > 15:
    s = [t] + s
    t = (t>>1) + 1
  # Base-case division
  r = (1 << (t<<1)) / (q >> sq-t)

  for u in s:
    r = (r << u-t+1) - (r*r * (q >> sq-u) >> (t<<1))
    t = u
  return (r * (p >> sq)) >> sr

def pibs(a, b):
  if a == b:
    if a == 0:
      return (1, 1, 1123)
    p = a*(a*(32*a-48)+22)-3
    q = a*a*a*24893568
    t = 21460*a+1123
    return (p, -q, p*t)
  m = (a+b) >> 1
  p1, q1, t1 = pibs(a, m)
  p2, q2, t2 = pibs(m+1, b)
  return (p1*p2, q1*q2, q2*t1 + p1*t2)

def ebs(a, b):
  if a == b:
    if a == 0:
      return (1, 1)
    return (1, a)
  m = (a+b) >> 1
  p1, q1 = ebs(a, m)
  p2, q2 = ebs(m+1, b)
  return (p1*q2+p2, q1*q2)

if __name__ == '__main__':
  n = input()

  pi_terms = int(n*0.16975227728583067)

  # 10^n == e^p
  p = n*2.3025850929940457

  # Lambert W_0(p/e) a la Newton
  k = log(p) - 1
  w = k - (k-1)/(k+1)
  while k > w:
    k = w
    w -= (k - p*exp(-k-1))/(k+1)

  # InverseGamma(e^p) approximation
  e_terms = int(p / w)

  pp, pq, pt = pibs(0, pi_terms)
  ep, eq = ebs(0, e_terms)

  z = 10**n
  p = 3528*z*ep*abs(pq)
  q = eq*abs(pt)

  pie = divnr(p, q)
  print pie,

Ideone doesn't seem to have gmpy2 installed, which is unfortunate for at least two reasons. One, because it would make the calcuation a lot faster, and two, because it makes any formula requiring an arbitrary precision square root impractical.
The formula I use for π was listed by Ramanujan as Formula (39):

which converges at the rate of ~5.89 digits per term. To my knowledge, this is the fastest converging series of its kind that doesn't require the evaluation of an arbitrary precision square root. Formula (44) in the same paper (convergence rate ~7.98 digits per term) is most often referred to as the Ramanujan Formula.
The formula I use for e is the sum of inverse factorials. The number of terms required is calculated as Γ-1(10n), using an approximation I found on mathoverflow. The Lambert W0 component is found using Newton's Method.
The calculation of each of these summations is done via the Fast E-function Evalution (more generally known as binary-splitting), originally devised by Karatsuba. The method reduces a summation to n terms to a single rational value p/q. These two values are then multiplied to produce the final result.
Update:
Profiling revealed that over half of the time needed for the calculation was spent in the final division. Only the upper most log2(10n) bits of q are needed to obtain full precision, so I trim a few off beforehand. The code now fills the Ideone output buffer in 3.33s.
Update 2:
Since this is an optimization challenge, I decided to write my own division routine to combat CPython's slowness. The implementation of divnr above uses Newton-Raphson Division. The general idea is to calculate d = 1/q · 2n using Newton's Method, where n is the number of bits the result requires, and compute the result as p · d >> n. Runtime is now 2.87s - and this is without even chopping off bits before the calculation; it's unnecessary for this method.

PARI/GP : 33000
This is basically the program given at OEIS, modified to take input and format output correctly. It should serve as a baseline to beat, if nothing else.
I assume this is accurate. I checked it at 100 and 20k against OEIS, and it matched for both. It's quite hard to find further digits online to check against.
For 33,000 it takes about 4.5s, so it could probably be bumped a small bit. I just got tired of fiddling with the input and ideone's slow-ass submit/compile/run loop.
{
    m=eval(input());
    default(realprecision, m+80);
    x=Pi*exp(1);
    s="8.";
    d=floor(x);
    x=(x-d)*10;
    for (n=1, m, d=floor(x);
         x=(x-d)*10;
         s=Str(s,d));
    print(s);
}

Ideone.com link

Your digits match mine, so I'm going to go out on a limb and say they're probably correct.

This program spends essentially all of its time in the loop, generating digits one by one. If you just take Str(floor(frac(x)*10^m) it goes hundreds/thousands of times faster.

Python 3
Since the built in pi and e don't have enough digits, I decided to calculate my own.
import decimal
import math
decimal.getcontext().prec=1000000
decimal=decimal.Decimal;b=2500
print(str(sum([decimal(1/math.factorial(x)) for x in range(b)])*sum([decimal(1/16**i*(4/(8*i+1)-2/(8*i+4)-1/(8*i+5)-1/(8*i+6))) for i in range(b)]))[0:int(input())+2])

IDEOne link
Output for STDIN = 1000:
8.5397342226735669504281233688422467204743749305568824722710929852470173635361001388261308713809518841081669216573834376992066672804294594807026609638293539437286935503772101801433821053915371716284188665787967232464763808892618434263301810056154560438283877633957941572944822034479453916753507796910068912594560500836608215235605783723340714760960119319145912948480279651779184356994356172418603464628747082162475871780202868607325544781551065680583616058471475977367814338295574582450942453416002008665325253385672668994300796223139976640645190237481531851902147391807396201201799703915343423499008135819239684881566321559967077443367982975103648727755579256820566722752546407521965713336095320920822985129589997143740696972018563360331663471959214120971348584257396673542429063767170337770469161945592685537660073097456725716654388703941509676413429681372333615691533682226329180996924321063261666235129175134250645330301407536588271020457172050227357541822742441070313522061438812060477519238440079

Nmax is the largest input value you can give your program before ideone will no longer run it.

@Calvin'sHobbies I think that nmax is arbitrarily large though...

ideone doesn't give you infinite computing power. What is the largest input value your program can run on ideone? (Though in fact your program does not follow the should be able to work for any N, given unlimited resources rule. Most of the output is zeros at around N = 10000.)

That's not python3: NameError: name 'xrange' not defined.

Scala - 1790
IDEOne at http://ideone.com/A2CIto.
We use Wetherfield's formula for π (and Machin-formula code crudely ported from here). We calculate e using the ordinary power series.
object Main extends App {
  import java.math.{BigDecimal => JDecimal}
  import java.math.RoundingMode._
  import scala.concurrent.Future
  import scala.concurrent.Await
  import scala.concurrent.ExecutionContext.Implicits._
  import scala.concurrent.duration._
  val precision = 1800

  def acotPrecision(numDigits: Int)(x: BigDecimal) = {
    val x1 = x.underlying
    val two = JDecimal.valueOf(2)
    val xSquared = x1 pow 2
    val unity = JDecimal.ONE.setScale(numDigits, HALF_EVEN)
    var sum = unity.divide(x1, HALF_EVEN)
    var xpower = new JDecimal(sum.toString)
    var term = unity

    var add = false

    var n = JDecimal.valueOf(3).setScale(numDigits)
    while (term.setScale(numDigits, HALF_EVEN).compareTo(JDecimal.ZERO) != 0) {
      xpower = xpower.divide(xSquared, HALF_EVEN)
      term = xpower.divide(n, HALF_EVEN)
      sum = if (add) sum add term else sum subtract term
      add = !add
      n = n add two
    }
    sum
  }

  def ePrecision(numDigits: Int) = {
    val zero = JDecimal.ZERO
    var sum = zero
    var term = JDecimal.ONE.setScale(numDigits, HALF_EVEN)
    var n = JDecimal.ONE.setScale(numDigits, HALF_EVEN)
    while(term.setScale(numDigits, HALF_EVEN).compareTo(zero) != 0) {
      sum = sum add term
      term = term.divide(n, HALF_EVEN)
      n = n add JDecimal.ONE
    }
    sum
  }

  val acot = acotPrecision(precision) _

  def d(x: Int) = JDecimal.valueOf(x)

  def piFuture = Future(d(4) multiply (
    (d(83) multiply acot(107)) add (d(17) multiply acot(1710)) subtract (d(22) multiply acot(103697))
    subtract (d(24) multiply acot(2513489)) subtract (d(44) multiply acot(18280007883L))
   add (d(12) multiply acot(7939642926390344818L))
   add (d(22) multiply acot(BigDecimal("3054211727257704725384731479018")))
  ))

  def eFuture = Future(ePrecision(precision))

  Await.result(
    for (pi <- piFuture;
         e <- eFuture) yield println((pi multiply e).setScale(precision - 10, DOWN))
  , 5 seconds)
}

Java, 15,053
interface M{
  static void main(String[]a){
    int n=new Integer(new java.util.Scanner(System.in).nextInt()),i=1,x=n/100+9;
    var t=java.math.BigInteger.TEN.pow(n+=x).shiftLeft(1);
    var p=t;
    var s=t.TEN.pow(n-x);
    var e=s;
    for(;i<5e4;
      e=s.add(e.divide(s.valueOf(50001-i))))
      p=p.add(t=t.multiply(t.valueOf(i)).divide(t.valueOf(i+++i)));
    System.out.print((""+p.multiply(e)).substring(0,n-x));
  }
}

Outputs the digits without decimal dot after the leading 8.
Try it on ideone.
Increasing the 5e4/50001 will both increase the run-time and digit-accuracy. With 50,000 iterations, which runs in ~4-5 seconds usually, \$15\text{,}053\$ is the largest amount of digits we can reach with 100% accuracy. With an input of \$15\text{,}054\$, the last couple digits will be incorrect.
Uses a combination of my Java answer for the Calculate 500 digits of pi challenge and a port of this stackoverflow C# .NET answer with BigIntegers.

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