Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
20
Task/Hamming-numbers/Ring/hamming-numbers.ring
Normal file
20
Task/Hamming-numbers/Ring/hamming-numbers.ring
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
see "h(1) = 1" + nl
|
||||
for nr = 1 to 19
|
||||
see "h(" + (nr+1) + ") = " + hamming(nr) + nl
|
||||
next
|
||||
see "h(1691) = " + hamming(1690) + nl
|
||||
see nl
|
||||
|
||||
func hamming limit
|
||||
h = list(1690)
|
||||
h[1] =1
|
||||
x2 = 2 x3 = 3 x5 =5
|
||||
i = 0 j = 0 k =0
|
||||
for n =1 to limit
|
||||
h[n] = min(x2, min(x3, x5))
|
||||
if x2 = h[n] i = i +1 x2 =2 *h[i] ok
|
||||
if x3 = h[n] j = j +1 x3 =3 *h[j] ok
|
||||
if x5 = h[n] k = k +1 x5 =5 *h[k] ok
|
||||
next
|
||||
hamming = h[limit]
|
||||
return hamming
|
||||
Loading…
Add table
Add a link
Reference in a new issue