OFFSET
1,4
COMMENTS
The first occurrence of the numbers 0, 1, 2, 3, 4, ... is at indices 1, 2, 4, 8, 6, 7, 22, 26, 10, 13, 12, 18, 1366, 15, 50, 386, ... - Robert G. Wilson v, May 15 2008
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..10000.
Wikipedia, Faro shuffle.
FORMULA
For n>2, if 2n-1 is in A014657, then a(n) = A002326(n-1)/2 - 1, otherwise a(n) = A002326(n-1) - 1. In particular, if A002326(n-1) is odd, then a(n) = A002326(n-1) - 1. - Max Alekseyev, May 21 2008, Dec 09 2017
For n>2, a(n) = A003558(n-1) - 1. - Joerg Arndt, Sep 12 2013
EXAMPLE
6->3->4->2->1. So a(6)=4.
MATHEMATICA
f[n_] := Block[{lst = {n}, a}, While[a = lst[[ -1]]; a != 1, If[EvenQ@a, AppendTo[lst, a/2], AppendTo[lst, lst[[1]] - (a + 1)/2]]]; Length@ lst - 1]; Array[f, 79] (* Robert G. Wilson v, May 15 2008 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Yasutoshi Kohmoto, Apr 23 2008
EXTENSIONS
More terms from Robert G. Wilson v, May 15 2008
Edited by Max Alekseyev, Dec 09 2017
STATUS
approved