Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,36 @@
$ include "seed7_05.s7i";
include "rational.s7i";
const func array integer: fractran (in integer: limit, in var integer: number, in array rational: program) is func
result
var array integer: output is 0 times 0;
local
var integer: index is 1;
var rational: newNumber is 0/1;
begin
output := [] (number);
while index <= length(program) and length(output) <= limit do
newNumber := rat(number) * program[index];
if newNumber = rat(trunc(newNumber)) then
number := trunc(newNumber);
output &:= number;
index := 1;
else
incr(index);
end if;
end while;
end func;
const proc: main is func
local
const array rational: program is []
(17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1);
var array integer: output is 0 times 0;
var integer: number is 0;
begin
output := fractran(15, 2, program);
for number range output do
write(number <& " ");
end for;
writeln;
end func;

View file

@ -0,0 +1,29 @@
$ include "seed7_05.s7i";
include "bigrat.s7i";
const proc: fractran (in var bigInteger: number, in array bigRational: program) is func
local
var integer: index is 1;
var bigRational: newNumber is 0_/1_;
begin
while index <= length(program) do
newNumber := rat(number) * program[index];
if newNumber = rat(trunc(newNumber)) then
number := trunc(newNumber);
if 2_ ** ord(log2(number)) = number then
writeln(log2(number));
end if;
index := 1;
else
incr(index);
end if;
end while;
end func;
const proc: main is func
local
const array bigRational: program is []
(17_/91_, 78_/85_, 19_/51_, 23_/38_, 29_/33_, 77_/29_, 95_/23_, 77_/19_, 1_/17_, 11_/13_, 13_/11_, 15_/14_, 15_/2_, 55_/1_);
begin
fractran(2_, program);
end func;