Data update
This commit is contained in:
parent
5af6d93694
commit
796d366b97
455 changed files with 7413 additions and 1900 deletions
33
Task/Farey-sequence/Maxima/farey-sequence.maxima
Normal file
33
Task/Farey-sequence/Maxima/farey-sequence.maxima
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
farey(n):=if n=1 then ["0/1","1/1"] else block(
|
||||
create_list([i,j],i,0,n-1,j,1,n),
|
||||
map(lambda([x],if x[1]=0 and x[2]#1 then false else if x[1]=x[2] and x[1]#1 then false else if x[1]<=x[2] then x),%%),
|
||||
delete(false,%%),
|
||||
unique(map(lambda([x],x[1]/x[2]),%%)),
|
||||
append(rest(append(["0/1"],rest(%%)),-1),["1/1"])
|
||||
)$
|
||||
|
||||
/* Test cases */
|
||||
/* Sequences from order 1 through 11 */
|
||||
farey(1);
|
||||
farey(2);
|
||||
farey(3);
|
||||
farey(4);
|
||||
farey(5);
|
||||
farey(6);
|
||||
farey(7);
|
||||
farey(8);
|
||||
farey(9);
|
||||
farey(10);
|
||||
farey(11);
|
||||
|
||||
/* Length of sequences from order 100 through, 1000 by hundreds */
|
||||
length(farey(100));
|
||||
length(farey(200));
|
||||
length(farey(300));
|
||||
length(farey(400));
|
||||
length(farey(500));
|
||||
length(farey(600));
|
||||
length(farey(700));
|
||||
length(farey(800));
|
||||
length(farey(900));
|
||||
length(farey(1000));
|
||||
Loading…
Add table
Add a link
Reference in a new issue