OFFSET
1
REFERENCES
Dekking, Michel, Michel Mendes France, and Alf van der Poorten. "Folds." The Mathematical Intelligencer, 4.3 (1982): 130-138 & front cover, and 4:4 (1982): 173-181 (printed in two parts). See Section 1.5.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Jean-Paul Allouche, Schrödinger Operators with Rudin-Shapiro Potentials are not Palindromic, Journal of Mathematical Physics, volume 38, number 4, 1997, pages 1843-1848. And the author's copy. Section IV paperfolding sequence z_n = a(n) for case i_m = m mod 2.
Mark D. LaDue, Clusters of Integers with Equal Total Stopping Times in the 3x + 1 Problem, arXiv:1709.02979 [math.NT], 2017.
Kevin Ryde, Iterations of the Alternate Paperfolding Curve, see index "TurnRpred".
Eric Weisstein's World of Mathematics, Collatz Problem
Wikipedia, Collatz conjecture
FORMULA
From Robert Israel, Sep 12 2017: (Start)
G.f.: Sum_{k>=0} (z^(2*4^k)/(1-z^(8*4^k)) + z^(3*4^k)/(1-z^(4*4^k))). (End)
From Jianing Song, Nov 27 2021: (Start)
Write n = (2*k+1) * 2^e, then a(n) = (k+e) mod 2.
A003324(2*n) = 2*(a(n)+1).
A209615(n) = (-1)^a(n).
a(n) = 1 - A106665(n-1). (End)
a(n) = A085062(n-1) mod 2. - Alois P. Heinz, Jul 01 2023
MAPLE
f:= proc(n) local k, m;
k:= padic:-ordp(n, 2);
m:= n/2^k;
(1 + (-1)^((m+1)/2+k))/2
end proc:
map(f, [$1..200]); # Robert Israel, Sep 12 2017
MATHEMATICA
a[1] = 0; a[n_] := a[n] = 1 - If[OddQ[n], a[n-2], a[n/2]];
Array[a, 100] (* Jean-François Alcover, Dec 09 2017 *)
PROG
(PARI) a(n) = if (n==1, 0, if (n%2, 1 - a(n-2), 1 - a(n/2)));
(PARI) a(n) = my(e=valuation(n, 2), k=bittest(n, e+1)); (k+e)%2 \\ Jianing Song, Nov 27 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michel Marcus, Sep 12 2017
STATUS
approved