Wednesday, January 11, 2006

prime binary approximant sqrt 2

echo 'scale=1000; obase=2; sqrt(2)/2' | bc | perl -pwe 's/\.//; s/\\\n//' | perl -nlwe 'BEGIN {print "ibase=2"} for($i=0; $i<length; $i++) { $x=substr $_,$i,1; if ($x eq "1") {print substr $_,0,($i+1)}}' | bc | perl -pwe 's/\\\n//' | perl -nlwe 'print "isprime($_)"' | athrun gp | grep '1$'

%2 = 1
%3 = 1
%5 = 1
%7 = 1
%8 = 1
%11 = 1
%41 = 1
%63 = 1
%67 = 1
%73 = 1
%642 = 1
%892 = 1
%1594 = 1

No comments :