What happens when you have too much time on your hands and you are getting drunk on vodka with a russian mathematician? Well, you get to proving that trancendental numbers are really digit sequences of uniform distribution over the 0 to 9 range.

Now that I am sober, I don't understand much of the reason behind all that, but this is a pretty nifty tool to print the relative density of digits in any numeric sequence. You can even use 'bc' or another arbitrary precision calculator to generate your large numbers.

How can we make this obfuscated?

Thanks japhy for your help. I've incorporated the smaller reader.

Actually looking at your array duplication, I can further take out the inner for loop.

#!/usr/bin/perl
#script.pl
#basically read all the input, separate the digits, and
#then figure out how many of each are there.
#@p=split(//,'0000000000');
#map ($_ =~ s/\D//g, @x=<>);
#map ( {$p[$_]++;$c++} split(//,join('',@x)));
#print join("\n", map({ $l=$m++.' -->';for ($k=0;$k<($_/$c)*100;$k++)
+{ $l.="*"; }; $l; } @p))."\n";
@p=(0)x10;
$_=join '', <>;
++$c&&$p[$&]++while/\d/g;
print join("\n", map({ $m++.' -->'.(('*')x(($_/$c)*100));} @p))."\n";
# use with bc as
# echo "space 20;sqrt(2)" | bc -lq | script.pl

Shoot. I am missing something here. I tried your code. It loops the right number of times, but it seems to only see the last character (the first match in a greedy match). So an input of '12345' looks like '55555'.

To test I tried

$x="12345";
for ($x=~ /./g) {
print $&;
}
print "\n";

Your assumptions about digit distribution of transcendental
numbers are incorrect. There are 2 separate concepts:
Transcendental numbers are number like e and π and
a=10^-(1!)+10^-(2!)+10^-(3!)+10^-(4!)+... which are
not roots of equations with rational coefficients. Normal
numbers are numbers (like 0.12345678910111213141516...,
although that is hard to prove!) that have every finite
sequence of digits (either in their base-10 representation
(or some other base) or, if you take the stronger more
common definition, in all bases) appearing at the
"appropriate" frequency.

It is not known whether π is normal. (See
my
writeup on Everything2 for details and more links).
It is known that many transcendental numbers are
not normal. For instance, the number a above cannot be
normal, as the only digits appearing in its decimal
representation are 0 and 1.

Comment onDigit DensityDownloadCode