RosettaCodeData/Task/Recamans-sequence/EasyLang/recamans-sequence.easy

20 lines
249 B
Text
Raw Permalink Normal View History

2023-09-16 17:28:03 -07:00
len seen[] 100
#
a[] &= 0
2026-04-30 12:34:36 -04:00
seen[1] = 1
2023-09-16 17:28:03 -07:00
i = 1
repeat
2026-04-30 12:34:36 -04:00
h = a[i - 1 + 1] - i
if h <= 0 or seen[h + 1] = 1
h = a[i - 1 + 1] + i
2023-09-16 17:28:03 -07:00
.
2026-04-30 12:34:36 -04:00
until seen[h + 1] = 1
seen[h + 1] = 1
2023-09-16 17:28:03 -07:00
a[] &= h
if i = 14
print a[]
.
i += 1
.
print h