OFFSET
0,2
COMMENTS
The 3x+1 or Collatz problem is as follows: start with any number n. If n is even, divide it by 2, otherwise multiply it by 3 and add 1. Do we always reach 1? This is an unsolved problem. It is conjectured that the answer is yes.
The Krasikov-Lagarias paper shows that at least N^0.84 of the positive numbers < N fall into the 4-2-1 cycle of the 3x+1 problem. This is far short of what we think is true, that all positive numbers fall into this cycle, but it is a step. - Richard C. Schroeppel, May 01 2002
a(n) is the image of a(2*n) under the 3*x+1 map. - L. Edson Jeffery, Aug 17 2014
The positions of powers of 2 in this sequence are given in A160967. - Federico Provvedi, Oct 06 2021
REFERENCES
R. K. Guy, Unsolved Problems in Number Theory, E16.
J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
T. D. Noe, Table of n, a(n) for n = 0..1000
Darrell Cox, The 3n + 1 Problem: A Probabilistic Approach, Journal of Integer Sequences, Vol. 15 (2012), #12.5.2.
David Eisenbud and Brady Haran, UNCRACKABLE? The Collatz Conjecture, Numberphile Video, 2016.
I. Krasikov and J. C. Lagarias, Bounds for the 3x+1 Problem using Difference Inequalities, arXiv:math/0205002 [math.NT], 2002.
J. C. Lagarias, The 3x+1 problem and its generalizations, Amer. Math. Monthly, 92 (1985), 3-23.
J. C. Lagarias, The set of rational cycles for the 3x+1 problem, Acta Arithmetica, LVI (1990), pp. 33-53.
J. C. Lagarias, The 3x+1 Problem: An Annotated Bibliography (1963-2000), arXiv:math/0309224 [math.NT], 2003-2011.
J. C. Lagarias, The 3x+1 Problem: an annotated bibliography, II (2000-2009), arXiv:math/0608208 [math.NT], 2006-2012.
Jeffrey C. Lagarias, The 3x+1 Problem: An Overview, arXiv:2111.02635 [math.NT], 2021.
Simon Plouffe, Approximations de séries génératrices et quelques conjectures, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
Simon Plouffe, 1031 Generating Functions, Appendix to Thesis, Montreal, 1992.
E. Roosendaal, On the 3x+1 problem.
S. Schreiber & N. J. A. Sloane, Correspondence, 1980.
Eric Weisstein's World of Mathematics, Collatz Problem.
Wikipedia, Collatz conjecture.
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
G.f.: (4*x+x^2+2*x^3) / (1-x^2)^2.
a(n) = (1/4)*(7*n+2-(-1)^n*(5*n+2)). - Benoit Cloitre, May 12 2002
a(n) = ((n mod 2)*2 + 1)*n/(2 - (n mod 2)) + (n mod 2). - Reinhard Zumkeller, Sep 12 2002
a(n) = a(a(2*n)) = -A001281(-n) for all n in Z. - Michael Somos, Nov 10 2016
E.g.f.: (2 + x)*sinh(x)/2 + 3*x*cosh(x). - Ilya Gutkovskiy, Dec 20 2016
From Federico Provvedi, Aug 17 2021: (Start)
Dirichlet g.f.: (1-2^(-s))*zeta(s) + (3-5*2^(-s))*zeta(s-1).
a(n) = ( a(n+2k) + a(n-2k) ) / 2, for every integer k. (End)
EXAMPLE
G.f. = 4*x + x^2 + 10*x^3 + 2*x^4 + 16*x^5 + 3*x^6 + 22*x^7 + 4*x^8 + 28*x^9 + ...
From Omar E. Pol, Jan 03 2022: (Start)
Written as a rectangular array with six columns read by rows the sequence begins:
0, 4, 1, 10, 2, 16;
3, 22, 4, 28, 5, 34;
6, 40, 7, 46, 8, 52;
9, 58, 10, 64, 11, 70;
12, 76, 13, 82, 14, 88;
15, 94, 16, 100, 17, 106;
18, 112, 19, 118, 20, 124;
21, 130, 22, 136, 23, 142;
24, 148, 25, 154, 26, 160;
27, 166, 28, 172, 29, 178;
30, 184, 31, 190, 32, 196;
...
(End)
MAPLE
f := n-> if n mod 2 = 0 then n/2 else 3*n+1; fi;
A006370:=(4+z+2*z**2)/(z-1)**2/(1+z)**2; # Simon Plouffe in his 1992 dissertation; uses offset 0
MATHEMATICA
f[n_]:=If[EvenQ[n], n/2, 3n+1]; Table[f[n], {n, 50}] (* Geoffrey Critzer, Jun 29 2013 *)
LinearRecurrence[{0, 2, 0, -1}, {4, 1, 10, 2}, 70] (* Harvey P. Dale, Jul 19 2016 *)
PROG
(PARI) for(n=1, 100, print1((1/4)*(7*n+2-(-1)^n*(5*n+2)), ", "))
(PARI) A006370(n)=if(n%2, 3*n+1, n/2) \\ Michael B. Porter, May 29 2010
(Haskell)
a006370 n | m /= 0 = 3 * n + 1
| otherwise = n' where (n', m) = divMod n 2
-- Reinhard Zumkeller, Oct 07 2011
(Python)
def A006370(n):
q, r = divmod(n, 2)
return 3*n+1 if r else q # Chai Wah Wu, Jan 04 2015
(Magma) [(1/4)*(7*n+2-(-1)^n*(5*n+2)): n in [1..70]]; // Vincenzo Librandi, Dec 20 2016
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001
Zero prepended and new Name from N. J. A. Sloane at the suggestion of M. F. Hasler, Nov 06 2017
STATUS
approved