

A321512


Characteristic function of the reverse in the shuffle (perfect faro shuffle with cut): 1 if the sequence of shuffles of n cards contains the reverse of the original order of cards, 0 if not.


1



1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1


COMMENTS

The characteristic function of A321580: 1 if in the sequence of Faro's shuffle of n cards there is at some point the exact reverse of the initial order (the cards are backwards); 0 if not.


LINKS

Table of n, a(n) for n=1..100.
Index entries for characteristic functions


EXAMPLE

For example, for n = 4, we have the following sequence of shuffles:
c(1) = 1234 < initial order of cards
c(2) = 2413
c(3) = 4321 < here's the reverse of c(1)
c(4) = 3142
c(5) = 1234
Hence the characteristic function at n = 4 is 1.
For n = 5,
c(1) = 12345
c(2) = 24135
c(3) = 43215
c(4) = 31425
c(5) = 12345
Observe that for n = 5, there's no 54321 in the c(i) sequence, so the characteristic function at n = 5 is 0.


PROG

(Python3)
for n in range(1, 101):
cards = [i for i in range(1, n + 1)]
reverse = cards[::1]
shuffled = cards.copy()
reversein = False
for i in range(n):
evens = shuffled[1::2]
odds = shuffled[0::2]
shuffled = evens + odds
if shuffled == reverse:
reversein = True
print(n, int(reversein))


CROSSREFS

Cf. A024222, A123320, A049206.
Sequence in context: A154269 A036987 A181101 * A297054 A266459 A214509
Adjacent sequences: A321509 A321510 A321511 * A321513 A321514 A321515


KEYWORD

nonn


AUTHOR

Pedro Menezes, Nov 11 2018


STATUS

approved



