Writing a program to illustrate a fractal

Musatov tomusatov at gmail.com
Sun Aug 26 13:58:05 EDT 2018


On Sunday, August 26, 2018 at 12:49:16 PM UTC-5, Richard Damon wrote:
> On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
> >> The sequence is defined by:
> >>
> >> For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = a(n) + a(n-2).
> >>
> > 	Confusing explanation -- do you really mean that for n>=4 you are
> > returning TWO values? 
	
For a(4)..a(19) we have that: 2+3=5, 1+3=4, 3+5=8, 2+5=7, 5+4=9, 3+4=7, 4+8=12, 5+8=13, 8+7=15, 4+7=11, 7+9=16, 8+9=17, 9+7=16, 7+7=14, 7+12=19, 9+12=21.

If so, it is not a strict function. I'd also write it
> > as
> 
> I think they intend that a(n) is defined for n being an integer (or
> maybe just the Natural Numbers, since it isn't defined for values below 1)
> 
> The two provided definitions provide the recursive definition for even
> and odd values.
> 
> I am not sure what 'fractal' property this sequence has that he wants to
> display.

I'm sorry, let me try to explain:

Here is my output:
1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 28, 27, 26, 24, 27, 31, 33, 28, 33, 32, 30, 31, 33, 35, 40, 35, 46, 44, 45, 41, 48, 53, 55, 47, 53, 54, 50, 51, 51, 53,

It is an OEIS sequence. 

I was told this image of the scatterplot emphasizes the 'fractal nature' of my sequence:

https://oeis.org/A292575/a292575.png



More information about the Python-list mailing list