Monday, March 25, 2019

You are not logged in.

## #1 2018-06-16 04:49:20 pm

Marc Anthony
Member
From:: Dallas, TX
Registered: 2006-04-27
Posts: 857

### Recaman integer sequence visualization

Mathematical concept:
http://mathworld.wolfram.com/RecamansSequence.html

Visual representation of my code product:
http://oi64.tinypic.com/25rcyh2.jpg

A link to a video of someone else's code product:
https://www.youtube.com/watch?v=j7iJTg4VYQI

#### Applescript:

(*
### An implementation of a method to realize and visualize integer sequence A005132—AKA the Recamán sequence—along a linear axis.

This code implementation is copyright 2018, by Marc Anthony; it is not for distribution or for any commercial use without the express written permission of the author. While the author is responsible for any perceived (or actual) faults or virtues inherent in the code, the code operator assumes all risks associated with actually running it. No warranty is express or implied. You get what you pay for, yadda yadda yadda.*)

set counter to 0
set pointer to 0
set iteration to 33
set occupied to {}

repeat iteration times
tell (pointer - counter) to if (it is not less than 0) and (it is not in occupied) then
set pointer to it
else
set pointer to pointer + counter
end if
set occupied's end to pointer
set counter to counter + 1
end repeat

tell application "Adobe Illustrator" to tell (make document)
set counter to 1
set thePath to make path item
repeat iteration times
tell thePath to make new path point with properties ¬
{anchor:{(occupied's item counter), 0}, left direction:{(occupied's item counter), my oscillate(counter)}, right direction:{(occupied's item counter), my oscillate(-counter)}}
set counter to counter + 1
end repeat
end tell

on oscillate(num)
if num mod 2 = 0 then
-num
else
num
end if
end oscillate

Offline

## Board footer

Powered by FluxBB