Cullen and Woodall numbers: Difference between revisions
Content added Content deleted
Alextretyak (talk | contribs) m (Fix Python solution output) |
(Added XPL0 example.) |
||
Line 985: | Line 985: | ||
First 12 Woodall primes (in terms of n): |
First 12 Woodall primes (in terms of n): |
||
2 3 6 30 75 81 115 123 249 362 384 462 |
2 3 6 30 75 81 115 123 249 362 384 462 |
||
</pre> |
|||
=={{header|XPL0}}== |
|||
{{trans|11l}} |
|||
<syntaxhighlight lang "XPL0">func Cullen(N); |
|||
int N; |
|||
return N<<N + 1; |
|||
func Woodall(N); |
|||
int N; |
|||
return N<<N - 1; |
|||
int I; |
|||
[Text(0, "First 20 Cullen numbers:^m^j"); |
|||
for I:= 1 to 20 do |
|||
[IntOut(0, Cullen(I)); ChOut(0, ^ )]; |
|||
CrLf(0); |
|||
CrLf(0); |
|||
Text(0, "First 20 Woodall numbers:^m^j"); |
|||
for I:= 1 to 20 do |
|||
[IntOut(0, Woodall(I)); ChOut(0, ^ )]; |
|||
CrLf(0); |
|||
]</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> |
</pre> |