Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/Farey-sequence/Maple/farey-sequence.maple
Normal file
25
Task/Farey-sequence/Maple/farey-sequence.maple
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#Displays terms in Farey_sequence of order n
|
||||
farey_sequence := proc(n)
|
||||
local a,b,c,d,k;
|
||||
a,b,c,d := 0,1,1,n;
|
||||
printf("%d/%d", a,b);
|
||||
while c <= n do
|
||||
k := iquo(n+b,d);
|
||||
a,b,c,d := c,d,c*k-a,d*k-b;
|
||||
printf(", %d/%d", a,b)
|
||||
end do;
|
||||
printf("\n");
|
||||
end proc:
|
||||
|
||||
#Returns the length of a Farey sequence
|
||||
farey_len := proc(n)
|
||||
return 1 + add(NumberTheory:-Totient(k), k=1..n);
|
||||
end proc;
|
||||
|
||||
for i to 11 do
|
||||
farey_sequence(i);
|
||||
end do;
|
||||
printf("\n");
|
||||
for j from 100 to 1000 by 100 do
|
||||
printf("%d\n", farey_len(j));
|
||||
end do;
|
||||
Loading…
Add table
Add a link
Reference in a new issue