login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A317825 a(1) = 1, a(n) = 3*a(n/2) if n is even, a(n) = n - a(n-1) if n is odd. 5

%I #49 Sep 08 2022 08:46:22

%S 1,3,0,9,-4,0,7,27,-18,-12,23,0,13,21,-6,81,-64,-54,73,-36,57,69,-46,

%T 0,25,39,-12,63,-34,-18,49,243,-210,-192,227,-162,199,219,-180,-108,

%U 149,171,-128,207,-162,-138,185,0,49,75,-24,117,-64,-36,91,189,-132,-102,161,-54,115,147,-84,729,-664,-630,697,-576

%N a(1) = 1, a(n) = 3*a(n/2) if n is even, a(n) = n - a(n-1) if n is odd.

%C Sequence has an elegant fractal-like scatter plot, situated (approximately) symmetrically over X-axis.

%C 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.

%C 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

%H Antti Karttunen, <a href="/A317825/b317825.txt">Table of n, a(n) for n = 1..16383</a>

%H Altug Alkan, <a href="/A317825/a317825.png">A scatterplot of a(n) for n <= 2^15-1</a>

%H Altug Alkan, <a href="/A317825/a317825_1.png">A scatterplot of f_e(n) for n <= 2^15-1</a>

%H Altug Alkan, <a href="/A317825/a317825_2.png">A scatterplot of (A317825(n), abs(A318303(n)))</a>

%H Rémy Sigrist, <a href="/A317825/a317825_3.png">A colored scatterplot of (A317825(n), abs(A318303(n))) for n = 1..2^20-1 </a> (where the color is function of n)

%F From _A.H.M. Smeets_, Sep 01 2018: (Start)

%F Sum_{i = 1..2*n-1} a(i) = n^2 for n >= 0.

%F Sum_{i = 1..2*n} a(i) = 3*a(n) + n^2 for n >= 0, a(0) = 0.

%F Sum_{i = 1..36*2^n} a(i) = 162*A085350(n) for n >= 0.

%F Lim_{n -> infinity} a(n)/n^2 = 0.

%F Lim_{n -> infinity} (Sum_{i = 1..n} a(i))/n^2 = 1/4. (End)

%t Nest[Append[#1, If[EvenQ[#2], 3 #1[[#2/2]], #2 - #1[[-1]] ]] & @@ {#, Length@ # + 1} &, {1}, 67] (* _Michael De Vlieger_, Aug 22 2018 *)

%o (PARI) A317825(n) = if(1==n,n,if(!(n%2),3*A317825(n/2),n-A317825(n-1)));

%o (Python)

%o aa = [0]

%o a,n = 0,0

%o while n < 16383:

%o ....n = n+1

%o ....if n%2 == 0:

%o ........a = 3*aa[n//2]

%o ....else:

%o ........a = n-a

%o ....aa = aa+[a]

%o ....print(n,a) # _A.H.M. Smeets_, Sep 01 2018

%o (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

%Y Cf. A318265, A318303.

%K sign,look

%O 1,2

%A _Altug Alkan_ and _Antti Karttunen_, Aug 22 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 05:02 EDT 2024. Contains 371235 sequences. (Running on oeis4.)