The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A333590 a(n) = a(n-1) if half of the previous term pairs are inverted. a(n) = a(n-1) + 1 if more than half of the previous term pairs are inverted. a(n) = a(n-1) - 1 if fewer than half of the previous term pairs are inverted. a(1) = 0. 1

%I #19 Apr 12 2020 06:15:06

%S 0,0,-1,0,-1,-1,0,-1,-2,-1,0,-1,-2,-1,-2,-1,0,-1,-2,-3,-2,-1,0,-1,-2,

%T -3,-2,-1,0,-1,-2,-3,-2,-1,0,-1,-2,-3,-4,-3,-2,-1,0,1,0,-1,-2,-3,-4,

%U -5,-4,-3,-2,-1,0,1,0,-1,-2,-3,-4,-3,-2,-1,0,-1,-2,-3,-4,-3,-2,-1

%N a(n) = a(n-1) if half of the previous term pairs are inverted. a(n) = a(n-1) + 1 if more than half of the previous term pairs are inverted. a(n) = a(n-1) - 1 if fewer than half of the previous term pairs are inverted. a(1) = 0.

%C An inversion occurs when some term is greater than some later term.

%C A sequence of length n can have at most n * (n - 1) / 2 inversions.

%H Samuel B. Reid, <a href="/A333590/b333590.txt">Table of n, a(n) for n = 1..10000</a>

%H Samuel B. Reid, <a href="/A333590/a333590.png">Plot of one billion terms</a>

%H Samuel B. Reid, <a href="/A333590/a333590_1.c.txt">C program for A333590</a>

%H Rémy Sigrist, <a href="/A333590/a333590_1.png">Scatterplot of the ordinal transform of the first 10000000 terms</a>

%e There are zero inversions in the first two terms of this sequence. The maximum possible number of inversions in a sequence of length 2 is 1. 0 is less than half of 1, so the third term is 0 - 1 or -1.

%e There are two inversions in the first 3 terms of this sequence. The maximum possible number of inversions in a sequence of length 3 is 3. 2 is more than half of 3, so the fourth term is -1 + 1 or 0.

%o (C) See Links section.

%o (PARI) { v=0; f=vector(2*M=100); s=0; inv=0; for (n=1, 72, f[M+v]++; inv+=s; print1 (v", "); if (2*inv<t=n*(n-1)/2, s+=f[M+v]; v--, 2*inv>t, v++; s-=f[M+v])) \\ _Rémy Sigrist_, Mar 28 2020

%Y Cf. A323186.

%K sign

%O 1,9

%A _Samuel B. Reid_, Mar 27 2020

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 May 16 10:52 EDT 2024. Contains 372552 sequences. (Running on oeis4.)