Cullen and Woodall numbers: Difference between revisions

Content added Content deleted
(Fix wrong output in Python solution (the last number was missing))
(Added 11l)
Line 39: Line 39:
* [[oeis:A002234|OEIS:A002234 - Numbers k such that the Woodall number k*2^k - 1 is prime]]
* [[oeis:A002234|OEIS:A002234 - Numbers k such that the Woodall number k*2^k - 1 is prime]]



=={{header|11l}}==
{{trans|Python}}

<syntaxhighlight lang="11l">
F cullen(n)
R (n << n) + 1

F woodall(n)
R (n << n) - 1

print(‘First 20 Cullen numbers:’)
L(i) 1..20
print(cullen(i), end' ‘ ’)
print()
print()
print(‘First 20 Woodall numbers:’)
L(i) 1..20
print(woodall(i), end' ‘ ’)
print()
</syntaxhighlight>

{{out}}
<pre>
First 20 Cullen numbers:
3 9 25 65 161 385 897 2049 4609 10241 22529 49153 106497 229377 491521 1048577 2228225 4718593 9961473 20971521

First 20 Woodall numbers:
1 7 23 63 159 383 895 2047 4607 10239 22527 49151 106495 229375 491519 1048575 2228223 4718591 9961471 20971519
</pre>


=={{header|ALGOL 68}}==
=={{header|ALGOL 68}}==
Line 101: Line 131:
Index of the 1st 12 Woodall primes: 2 3 6 30 75 81 115 123 249 362 384 462
Index of the 1st 12 Woodall primes: 2 3 6 30 75 81 115 123 249 362 384 462
</pre>
</pre>

=={{header|Arturo}}==
=={{header|Arturo}}==