%======================================================================= % % Self-inverse permutations on n letters, % i.e. handshaking across a table, where not everybody is required % to shake, (or put in another way: some people may shake hands % with themselves). % Is enumerated by EIS A000085 (1,2,4,10,26,76,232,764,2620,9496,...) % % See also: % % http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=A000085 % http://www.research.att.com/~njas/sequences/a002694.gif % http://www.iki.fi/~kartturi/matikka/ModFin/A001147.fnd % % http://arp.anu.edu.au/~jks/finder.html % % %========================================================================== sort { ELEM cardinality = 1 } function { e: ELEM,ELEM -> bool. f: ELEM -> ELEM { cut } } clause { e(x,y) -> e(y,x). % Symmetric, if x shakes with y, then vice versa also. y=z; FALSE = e(x,y); FALSE = e(x,z). % Each shakes with max one person. e(x,f(x)). % Everybody shakes hands with somebody. } setting { verbosity stats: full stack: maximal } end