login
A walk based on the digits of sqrt(2) (A002193).
1

%I #7 Nov 22 2013 17:44:52

%S 1,2,3,4,3,2,1,2,3,4,3,2,1,2,3,4,5,6,5,4,3,2,3,4,5,6,7,6,5,4,3,2,1,0,

%T 1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,

%U 0,1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,3,4,3

%N A walk based on the digits of sqrt(2) (A002193).

%C sqrt(2)= 1. 41421354237...

%C Between 1 and 4 we place 2 and 3.

%C Between 4 and 1 we place 3 and 2.

%C Between 1 and 4 we place 2 and 3.

%C Between 4 and 2 we place 3 and so on.

%C This gives:

%C 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, ...

%C This could be called a walk (or promenade) on the digits of sqrt(2).

%H Reinhard Zumkeller, <a href="/A232244/b232244.txt">Table of n, a(n) for n = 1..10000</a>

%o (Haskell)

%o a232244 n = a232244_list !! (n-1)

%o a232244_list = 1 : concat (zipWith w a002193_list $ tail a002193_list)

%o where w v u | v > u = [v - 1, v - 2 .. u]

%o | v < u = [v + 1 .. u]

%o | otherwise = [v]

%o -- _Reinhard Zumkeller_, Nov 22 2013

%Y Cf. A002193.

%K nonn,easy,base

%O 1,2

%A _Philippe Deléham_, Nov 20 2013 at the suggestion of _N. J. A. Sloane_