This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A137605 #24 Jan 20 2025 22:42:23 %S A137605 0,1,1,2,2,4,5,3,3,8,5,10,9,8,13,4,4,11,17,11,9,6,11,22,20,7,25,19,8, %T A137605 28,29,5,5,32,21,34,8,19,29,38,26,40,7,27,10,11,9,35,23,14,49,50,11, %U A137605 52,17,35,13,43,11,23,54,19,49,6,6,64,17,35,33,68,45,59,13,41,73,14,23,19,25 %N A137605 Consider the sequence: b(0) = n, and for k >= 1, b(k) = b(k-1)/2 if b(k-1) is even, otherwise b(k) = n - (b(k-1)+1)/2. Then a(n) = m, where m is the smallest index such that b(m) = 1. %C A137605 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 %H A137605 Robert G. Wilson v, <a href="/A137605/b137605.txt">Table of n, a(n) for n = 1..10000</a>. %H A137605 Wikipedia, <a href="https://en.wikipedia.org/wiki/Faro_shuffle">Faro shuffle</a>. %F A137605 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 %F A137605 For n>2, a(n) = A003558(n-1) - 1. - _Joerg Arndt_, Sep 12 2013 %e A137605 6->3->4->2->1. So a(6)=4. %t A137605 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 *) %Y A137605 Cf. A002326, A003558, A137604. %K A137605 nonn %O A137605 1,4 %A A137605 _Yasutoshi Kohmoto_, Apr 23 2008 %E A137605 More terms from _Robert G. Wilson v_, May 15 2008 %E A137605 Edited by _Max Alekseyev_, Dec 09 2017