Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,30 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Leonardo is
function Leo
(N : Natural;
Step : Natural := 1;
First : Natural := 1;
Second : Natural := 1) return Natural is
L : array (0..1) of Natural := (First, Second);
begin
for i in 1 .. N loop
L := (L(1), L(0)+L(1)+Step);
end loop;
return L (0);
end Leo;
begin
Put_Line ("First 25 Leonardo numbers:");
for I in 0 .. 24 loop
Put (Integer'Image (Leo (I)));
end loop;
New_Line;
Put_Line ("First 25 Leonardo numbers with L(0) = 0, L(1) = 1, " &
"step = 0 (fibonacci numbers):");
for I in 0 .. 24 loop
Put (Integer'Image (Leo (I, 0, 0, 1)));
end loop;
New_Line;
end Leonardo;

View file

@ -1,46 +0,0 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. Leonardo_numbers.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 LIMITE PIC 99 VALUE 25.
01 L0 PIC 99(5).
01 L1 PIC 99(5).
01 SUMA PIC 99(5).
01 TMP PIC 99(5).
01 I PIC 99.
01 TEXTO PIC X(9).
PROCEDURE DIVISION.
MOVE 1 TO L0
MOVE 1 TO L1
MOVE 1 TO SUMA
MOVE "Leonardo" TO TEXTO
PERFORM DISPLAY-NUMBERS
MOVE 0 TO L0
MOVE 1 TO L1
MOVE 0 TO SUMA
MOVE "Fibonacci" TO TEXTO
PERFORM DISPLAY-NUMBERS
STOP RUN.
DISPLAY-NUMBERS.
DISPLAY "Numeros de " TEXTO " (" L0 "," L1 "," SUMA "):"
PERFORM VARYING I FROM 1 BY 1 UNTIL I > LIMITE
IF I = 1 THEN
DISPLAY " " L0 WITH NO ADVANCING
ELSE IF I = 2 THEN
DISPLAY " " L1 WITH NO ADVANCING
ELSE
COMPUTE TMP = L0 + L1 + SUMA
DISPLAY " " TMP WITH NO ADVANCING
MOVE L0 TO TMP
MOVE L1 TO L0
ADD TMP TO L1 GIVING L1
ADD SUMA TO L1
END-IF
END-PERFORM
DISPLAY " "
.

View file

@ -1,25 +1,29 @@
/*REXX pgm computes Leonardo numbers, allowing the specification of L(0), L(1), and ADD#*/
numeric digits 500 /*just in case the user gets ka-razy. */
@.=1 /*define the default for the @. array.*/
parse arg N L0 L1 a# . /*obtain optional arguments from the CL*/
if N =='' | N =="," then N= 25 /*Not specified? Then use the default.*/
if L0\=='' & L0\=="," then @.0= L0 /*Was " " " " value. */
if L1\=='' & L1\=="," then @.1= L1 /* " " " " " " */
if a#\=='' & a#\=="," then @.a= a# /* " " " " " " */
say 'The first ' N " Leonardo numbers are:" /*display a title for the output series*/
if @.0\==1 | @.1\==1 then say 'using ' @.0 " for L(0)"
if @.0\==1 | @.1\==1 then say 'using ' @.1 " for L(1)"
if @.a\==1 then say 'using ' @.a " for the add number"
say /*display blank line before the output.*/
$= /*initialize the output line to "null".*/
do j=0 for N /*construct a list of Leonardo numbers.*/
if j<2 then z=@.j /*for the 1st two numbers, use the fiat*/
else do /*··· otherwise, compute the Leonardo #*/
_=@.0 /*save the old primary Leonardo number.*/
@.0=@.1 /*store the new primary number in old. */
@.1=@.0 + _ + @.a /*compute the next Leonardo number. */
z=@.1 /*store the next Leonardo number in Z. */
end /* [↑] only 2 Leonardo #s are stored. */
$=$ z /*append the just computed # to $ list.*/
end /*j*/ /* [↓] elide the leading blank in $. */
say strip($) /*stick a fork in it, we're all done. */
-- 19 Sep 2025
include Setting
say 'LEONARDO NUMBERS'
say version
say
call Leonardo 24,1,1,1
call Leonardo 24,0,1,0
call Timer 'r'
exit
Leonardo:
-- Show sequence
arg nn,l0,l1,add
numeric digits 25
say 'First' nn+1 'Leonardo numbers starting with' l0','l1 'and adding' add
say
call CharOut ,Right(l0,8) Right(l1,7)
a=l0; b=l1
do i=2 to nn
c=b+a+add; a=b; b=c
call CharOut ,Right(c,8)
if i//5=4 | i//5=9 then
say
end
say
return
include Math