Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Yellowstone-sequence/REXX/yellowstone-sequence-1.rexx
Normal file
20
Task/Yellowstone-sequence/REXX/yellowstone-sequence-1.rexx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*REXX program calculates any number of terms in the Yellowstone (permutation) sequence.*/
|
||||
parse arg m . /*obtain optional argument from the CL.*/
|
||||
if m=='' | m=="," then m= 30 /*Not specified? Then use the default.*/
|
||||
!.= 0 /*initialize an array of numbers(used).*/
|
||||
# = 0 /*count of Yellowstone numbers in seq. */
|
||||
$= /*list " " " " " */
|
||||
do j=1 until #==m; prev= # - 1
|
||||
if j<5 then do; #= #+1; @.#= j; !.#= j; !.j= 1; $= strip($ j); iterate; end
|
||||
|
||||
do k=1; if !.k then iterate /*Already used? Then skip this number.*/
|
||||
if gcd(k, @.prev)<2 then iterate /*Not meet requirement? Then skip it. */
|
||||
if gcd(k, @.#) \==1 then iterate /* " " " " " " */
|
||||
#= #+1; @.#= k; !.k= 1; $= $ k /*bump ctr; assign; mark used; add list*/
|
||||
leave /*find the next Yellowstone seq. number*/
|
||||
end /*k*/
|
||||
end /*j*/
|
||||
say $ /*display a list of a Yellowstone seq. */
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
gcd: parse arg x,y; do until y==0; parse value x//y y with y x; end; return x
|
||||
21
Task/Yellowstone-sequence/REXX/yellowstone-sequence-2.rexx
Normal file
21
Task/Yellowstone-sequence/REXX/yellowstone-sequence-2.rexx
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*REXX program calculates any number of terms in the Yellowstone (permutation) sequence.*/
|
||||
parse arg m . /*obtain optional argument from the CL.*/
|
||||
if m=='' | m=="," then m= 30 /*Not specified? Then use the default.*/
|
||||
!.= 0 /*initialize an array of numbers(used).*/
|
||||
# = 0 /*count of Yellowstone numbers in seq. */
|
||||
$ = /*list " " " " " */
|
||||
do j=1 until #==m; prev= # - 1
|
||||
if j<5 then do; #= #+1; @.#= j; !.#= j; !.j= 1; $= strip($ j); iterate; end
|
||||
|
||||
do k=1; if !.k then iterate /*Already used? Then skip this number.*/
|
||||
if gcd(k, @.prev)<2 then iterate /*Not meet requirement? Then skip it. */
|
||||
if gcd(k, @.#) \==1 then iterate /* " " " " " " */
|
||||
#= # + 1; @.#= k; !.k= 1; $= $ k /*bump ctr; assign; mark used; add list*/
|
||||
leave /*find the next Yellowstone seq. number*/
|
||||
end /*k*/
|
||||
end /*j*/
|
||||
|
||||
call $histo $ '(vertical)' /*invoke a REXX vertical histogram plot*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
gcd: parse arg x,y; do until y==0; parse value x//y y with y x; end; return x
|
||||
Loading…
Add table
Add a link
Reference in a new issue