Ramsey's theorem: Difference between revisions

Content added Content deleted
m (→‎{{header|Racket}}: added a "no output" flag (it already had an "incorrect" flag).)
No edit summary
Line 974: Line 974:


Ramsey's condition is satisfied.
Ramsey's condition is satisfied.
</pre>

=={{header|Ring}}==
<lang ring>
# Project : Ramsey's theorem
# Date : 2017/10/22
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>

load "stdlib.ring"

a = newlist(17,17)
for i = 1 to 17
a[i][i] = -1
next
k = 1
while k <= 8
for i = 1 to 17
j = (i + k) % 17
if j != 0
a[i][j] = 1
a[j][i] = 1
ok
next
k = k * 2
end
for i = 1 to 17
for j = 1 to 17
see a[i][j] + " "
next
see nl
next
</lang>
Output:
<pre>
-11101000110001011
1-1110100011000101
11-111010001100010
011-11101000110001
1011-1110100011000
01011-111010001100
001011-11101000110
0001011-1110100011
10001011-111010000
110001011-11101000
0110001011-1110100
00110001011-111010
000110001011-11100
1000110001011-1110
01000110001011-110
101000110001011-10
1101000100000000-1
</pre>
</pre>