Yellowstone sequence: Difference between revisions
Content added Content deleted
m (→horizontal list of numbers: optimized the inner DO loop.) |
m (→vertical histogram plot: optimized the multiple IF classes.) |
||
Line 937:
!.= 0 /*initialize an array of numbers(used).*/
# = 0 /*count of Yellowstone numbers in seq. */
$
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, @.#) \==1
#= # + 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)'
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
|