OFFSET
1,2
COMMENTS
Sequence has an elegant fractal-like scatter plot, situated (approximately) symmetrically over X-axis.
This sequence can also be generalized with some modifications. Let f_k(1) = 1. f_k(n) = floor(k*a(n/2)) if n is even, f_k(n) = n - f_k(n-1) if n is odd. This sequence is a(n) = f_k(n) where k = 3. For example, if k is e (A001113), then recurrence also provides a curious fractal-like structure that has some similarities with a(n). See Links section for their plots.
A scatterplot of (Sum_{i = 1..2*n} a(i)) - n^2 gives a similar plot as for a(n). - A.H.M. Smeets, Sep 01 2018
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16383
Altug Alkan, A scatterplot of a(n) for n <= 2^15-1
Altug Alkan, A scatterplot of f_e(n) for n <= 2^15-1
Altug Alkan, A scatterplot of (A317825(n), abs(A318303(n)))
Rémy Sigrist, A colored scatterplot of (A317825(n), abs(A318303(n))) for n = 1..2^20-1 (where the color is function of n)
FORMULA
From A.H.M. Smeets, Sep 01 2018: (Start)
Sum_{i = 1..2*n-1} a(i) = n^2 for n >= 0.
Sum_{i = 1..2*n} a(i) = 3*a(n) + n^2 for n >= 0, a(0) = 0.
Sum_{i = 1..36*2^n} a(i) = 162*A085350(n) for n >= 0.
Lim_{n -> infinity} a(n)/n^2 = 0.
Lim_{n -> infinity} (Sum_{i = 1..n} a(i))/n^2 = 1/4. (End)
MATHEMATICA
Nest[Append[#1, If[EvenQ[#2], 3 #1[[#2/2]], #2 - #1[[-1]] ]] & @@ {#, Length@ # + 1} &, {1}, 67] (* Michael De Vlieger, Aug 22 2018 *)
PROG
(Python)
aa = [0]
a, n = 0, 0
while n < 16383:
....n = n+1
....if n%2 == 0:
........a = 3*aa[n//2]
....else:
........a = n-a
....aa = aa+[a]
....print(n, a) # A.H.M. Smeets, Sep 01 2018
(Magma) [n eq 1 select 1 else IsEven(n) select 3*Self(n div 2) else n- Self(n-1): n in [1..80]]; // Vincenzo Librandi, Sep 03 2018
CROSSREFS
KEYWORD
sign,look
AUTHOR
Altug Alkan and Antti Karttunen, Aug 22 2018
STATUS
approved