Coprimes: Difference between revisions

Content added Content deleted
(add Fermat)
m (fix)
Line 443: Line 443:
=={{header|Fermat}}==
=={{header|Fermat}}==
<lang fermat>Func Is_coprime(a, b) = if GCD(a,b)=1 then 1 else 0 fi.</lang>
<lang fermat>Func Is_coprime(a, b) = if GCD(a,b)=1 then 1 else 0 fi.</lang>

=={{header|FOCAL}}==
<lang focal>01.10 S P(1)=21; S Q(1)=15
01.20 S P(2)=17; S Q(2)=23
01.30 S P(3)=36; S Q(3)=12
01.40 S P(4)=18; S Q(4)=29
01.50 S P(5)=60; S Q(5)=15
01.60 F N=1,5;D 3
01.70 Q

02.10 I (A-B)2.2,2.6,2.4
02.20 S B=B-A
02.30 G 2.1
02.40 S A=A-B
02.50 G 2.1
02.60 R

03.10 S A=P(N)
03.20 S B=Q(N)
03.30 D 2
03.40 I (A-1)3.6,3.5,3.6
03.50 T %4,P(N),Q(N),!
03.60 R</lang>
{{out}}
<pre>= 17= 23
= 18= 29</pre>


=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
Line 473: Line 499:
false
false
</pre>
</pre>

=={{header|FOCAL}}==
<lang focal>01.10 S P(1)=21; S Q(1)=15
01.20 S P(2)=17; S Q(2)=23
01.30 S P(3)=36; S Q(3)=12
01.40 S P(4)=18; S Q(4)=29
01.50 S P(5)=60; S Q(5)=15
01.60 F N=1,5;D 3
01.70 Q

02.10 I (A-B)2.2,2.6,2.4
02.20 S B=B-A
02.30 G 2.1
02.40 S A=A-B
02.50 G 2.1
02.60 R

03.10 S A=P(N)
03.20 S B=Q(N)
03.30 D 2
03.40 I (A-1)3.6,3.5,3.6
03.50 T %4,P(N),Q(N),!
03.60 R</lang>
{{out}}
<pre>= 17= 23
= 18= 29</pre>


=={{header|Go}}==
=={{header|Go}}==