[go: up one dir, main page]

login
Sign of first differences of Recamán's sequence A005132.
11

%I #20 May 01 2020 22:25:02

%S 1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,

%T -1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,

%U -1,1,-1,1,-1,1,-1,1,-1,1,1,1,-1,1,-1

%N Sign of first differences of Recamán's sequence A005132.

%H T. D. Noe, <a href="/A160357/b160357.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = sign(A005132(n)-A005132(n-1)) = sign(A160356(n)) = (-1)^A160351(n) = -(-1)^A076213(n-1).

%F a(n) = (A005132(n)-A005132(n-1))/n. - _N. J. A. Sloane_, Jul 15 2011

%F A160357 = chi_A057165 - chi_A057166, where chi_A denotes the characteristic function of (the set of values of) A.

%p A160357 := proc(n)

%p sign( A005132(n)-A005132(n-1)) ;

%p end proc: # _R. J. Mathar_, Apr 01 2012

%t f[s_List] := Module[{a = s[[-1]], n = Length[s]}, Append[s, If[a > n && FreeQ[s, a - n], a - n, a + n]]];

%t Nest[f, {0}, 100] // Differences // Sign (* _Jean-François Alcover_, Apr 19 2020, using _Robert G. Wilson v_'s code for A005132 *)

%Y Cf. A005132, A119632.

%K sign

%O 0,1

%A _M. F. Hasler_, Jun 03 2009

%E a(0)=1 added by _N. J. A. Sloane_, May 01 2020