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!)
A131502 Half the number of permutations of 0..n with a zero n-th difference. 4

%I #16 Jun 05 2024 01:25:16

%S 0,0,1,1,8,3,136,29,928,942,66496,6175,2785856,205678,11122048

%N Half the number of permutations of 0..n with a zero n-th difference.

%e a(5)=3 because 0,1,2,3,4,5 ; 0,2,4,3,1,5 ; and 0,4,2,1,3,5 ; and their reverses have zero 5th differences.

%t (* naive and memory intensive implementation generating all permutations *)

%t Table[Count[

%t Map[Differences[#, n - 1] &,

%t Take[Permutations[Range[1, n]], Max[1, n!/2]]], {0}], {n, 1, 10}] (* _Olivier GĂ©rard_, May 30 2024 *)

%o (Python)

%o from math import comb

%o from itertools import permutations

%o def A131502(n):

%o c = [-comb(n,i) if i&1 else comb(n,i) for i in range(n+1)]

%o return sum(1 for p in permutations(range(n+1)) if p[0]<p[-1] and not sum(c[i]*p[i] for i in range(n+1))) # _Chai Wah Wu_, Jun 04 2024

%K nonn,more

%O 0,5

%A _R. H. Hardin_, Aug 13 2007

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 September 8 08:26 EDT 2024. Contains 375753 sequences. (Running on oeis4.)