Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $target = 479179/526680;
- $targetmax = $target + 0.000000001;
- $targetmin = $target - 0.000000001;
- $xsum = .0;
- $res = array();
- function doone ($start,$depth){
- $alpha = array (
- 1 => 'a', 2=>'b', 3=>'c', 4=>'d', 5=> 'e', 6=>'f',7=>'g', 8=>'h',
- 9 => 'i', 10=>'j', 11=>'k', 12=>'l', 13=>'m', 14=>'n',15=>'o', 16=>'p',
- 17=> 'q', 18=>'r', 19=>'s', 20=>'t', 21=>'u', 22=>'v', 23=>'w',24=>'x',
- 25=>'y',26=>'z');
- global $xsum, $res,$target,$targetmax,$targetmin;
- foreach (range($start, 26) as $a) {
- $m = 1/$a;
- if ($xsum + $m > $targetmax){
- continue;
- }
- $xsum +=$m;
- $res[]=$a;
- if ($depth == 9){
- if ($targetmin < $xsum && $xsum < $targetmax){
- foreach ($res as $b) {
- echo $alpha[$b];
- }
- echo "\n";
- }
- } else {
- doone($a,$depth+1);
- }
- $xsum -= $m;
- array_pop ($res);
- }
- }
- doone(2,1);
Advertisement
Add Comment
Please, Sign In to add comment