The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A321580 Numbers k such that it is possible to reverse a deck of k cards by a sequence of perfect Faro shuffles with cut. 2
 1, 2, 4, 8, 10, 12, 16, 18, 24, 26, 28, 32, 36, 40, 42, 52, 56, 58, 60, 64, 66, 80, 82, 96, 98, 100, 106, 108, 112, 120, 124, 128, 130, 136, 138, 144, 148, 156, 162, 168, 170, 172, 176, 178, 180, 184, 192, 196, 200, 204, 208, 210, 226, 228, 240, 242, 248, 250 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS Except for 1, it isn't possible to shuffle backwards an odd number of cards. LINKS Andrew Howroyd, Table of n, a(n) for n = 1..2000 Wikipedia, Faro shuffle EXAMPLE For a deck of 4 cards we'll have the following sequence of shuffles: 1234, 2413, 4321, 3142, 1234. Observe that the reverse order (4321) of 1234 appears in the sequence of shuffles. For a deck of 5 cards: 12345, 24135, 43215, 31425, 12345. Observe that the reverse order (54321) of 12345 does not appear in the sequence of shuffles. PROG (Python) for n in range(1, 501):    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)        break (PARI) shuffle(v)={my(h=#v\2); vector(#v, i, if(i<=h, 2*i, 2*(i-h)-1))} permcycs(v)={my(f=vector(#v), L=List()); for(i=1, #v, if(!f[i], my(T=List(), j=i); while(!f[j], f[j]=1; listput(T, j); j=v[j]); listput(L, Vec(T)))); Vec(L)} ok(n)={my(v=permcycs(shuffle([1..n])), e=-1); for(k=1, #v, my(p=v[k]); if(#p>1||n%2==0||2*p<>n+1, my(h=#p\2); if(e<0, e=valuation(#p, 2)); if(valuation(#p, 2)<>e || e==0 || p[1..h]+p[h+1..2*h]<>vector(h, i, n+1), return(0)))); 1} \\ Andrew Howroyd, Nov 13 2018 CROSSREFS Cf. A024222, A071642, A321512. Sequence in context: A195066 A036990 A097498 * A224694 A140900 A166936 Adjacent sequences:  A321577 A321578 A321579 * A321581 A321582 A321583 KEYWORD nonn AUTHOR Pedro Menezes, Nov 13 2018 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified July 4 16:24 EDT 2020. Contains 335448 sequences. (Running on oeis4.)