Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,44 @@
get "libhdr"
manifest $( AMOUNT = 1200 $)
let gcd(a,b) =
a>b -> gcd(a-b, b),
a<b -> gcd(a, b-a),
a
let mkstern(s, n) be
$( s!1 := 1
s!2 := 1
for i=2 to n/2 do
$( s!(i*2-1) := s!i + s!(i-1)
s!(i*2) := s!i
$)
$)
let find(v, n, max) = valof
for i=1 to max
if v!i=n then resultis i
let findwrite(v, n, max) be
writef("%I3 at %I4*N", n, find(v, n, max))
let start() be
$( let stern = vec AMOUNT
mkstern(stern, AMOUNT)
writes("First 15 numbers: ")
for i=1 to 15 do writef("%N ", stern!i)
writes("*N*NFirst occurrence:*N")
for i=1 to 10 do findwrite(stern, i, AMOUNT)
findwrite(stern, 100, AMOUNT)
if valof
$( for i=2 to AMOUNT
unless gcd(stern!i, stern!(i-1)) = 1
resultis false
resultis true
$) then
writes("*NThe GCD of each pair of consecutive members is 1.*N")
$)