Cullen and Woodall numbers: Difference between revisions
Content deleted Content added
Initial FutureBasic task solution added |
No edit summary |
||
Line 513: | Line 513: | ||
{{out}} |
{{out}} |
||
<pre>Igual que la entrada de FreeBASIC.</pre> |
<pre>Igual que la entrada de FreeBASIC.</pre> |
||
=={{header|Delphi}}== |
|||
{{works with|Delphi|6.0}} |
|||
{{libheader|SysUtils,StdCtrls}} |
|||
<syntaxhighlight lang="Delphi"> |
|||
uses SysUtils,StdCtrls; |
|||
procedure CullenWoodallTest(Memo: TMemo); |
|||
implementation |
|||
procedure FindCullenNumbers(Memo: TMemo); |
|||
var N,R: integer; |
|||
var S: string; |
|||
begin |
|||
S:=''; |
|||
Memo.Lines.Add('First 20 Cullen Numbers:'); |
|||
for N:=1 to 20 do |
|||
begin |
|||
R:=N * (1 shl N) + 1; |
|||
S:=S+IntToStr(R)+' '; |
|||
end; |
|||
Memo.Lines.Add(S); |
|||
end; |
|||
procedure FindWoodallNumbers(Memo: TMemo); |
|||
var N,R: integer; |
|||
var S: string; |
|||
begin |
|||
S:=''; |
|||
Memo.Lines.Add('First 20 Woodall Numbers:'); |
|||
for N:=1 to 20 do |
|||
begin |
|||
R:=N * (1 shl N) - 1; |
|||
S:=S+IntToStr(R)+' '; |
|||
end; |
|||
Memo.Lines.Add(S); |
|||
end; |
|||
procedure CullenWoodallTest(Memo: TMemo); |
|||
begin |
|||
FindCullenNumbers(Memo); |
|||
FindWoodallNumbers(Memo); |
|||
end; |
|||
</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> |
|||