login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A131529 Number of permutations of {1,2,...n} for which differences of adjacent numbers are all distinct. 0
1, 2, 4, 12, 44, 176, 788, 3936, 23264, 152112, 1104876, 8725320, 74715908, 687915040, 6782261964, 71294227456, 796138700016, 9409401651840, 117378774461812 (list; graph; refs; listen; history; internal format)
OFFSET

1,2

PROG

(C++) #include <iostream> #include <vector> #include <set> #include <algorithm> using namespace std; inline int k(const vector<int> & s) { const int n = s.size() ; set<int> diffs ; for(int i=1; i<n; i++) { const int thisdiff = s[i]-s[i-1] ; if ( diffs.find(thisdiff) != diffs.end() ) return 0 ; else diffs.insert(thisdiff) ; } return 1 ; } int main(int argc, char *argv[]) { for(int n=1 ;; n++) { vector<int> s; for(int i=1; i<=n; i++) s.push_back(i) ; unsigned long long resul=0 ; do { resul += k(s) ; } while( next_permutation(s.begin(), s.end()) ) ; cout << n << " " << resul << endl ; } return 0 ; } - R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Oct 25 2007

CROSSREFS

Cf. A040018, A091217, A006967.

Sequence in context: A179973 A039301 A180205 * A165901 A074449 A131387

Adjacent sequences:  A131526 A131527 A131528 * A131530 A131531 A131532

KEYWORD

more,nonn

AUTHOR

Vladeta Jovovic (vladeta(AT)eunet.rs), Aug 26 2007

EXTENSIONS

2 more terms from R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Oct 25 2007

7 more terms from R. H. Hardin (rhhardin(AT)att.net), Nov 26 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 15 08:49 EST 2012. Contains 205740 sequences.