[go: up one dir, main page]

login
Search: a277189 -id:a277189
     Sort: relevance | references | number | modified | created      Format: long | short | data
Stern's diatomic series (or Stern-Brocot sequence): a(0) = 0, a(1) = 1; for n > 0: a(2*n) = a(n), a(2*n+1) = a(n) + a(n+1).
(Formerly M0141 N0056)
+10
378
0, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, 1, 5, 4, 7, 3, 8, 5, 7, 2, 7, 5, 8, 3, 7, 4, 5, 1, 6, 5, 9, 4, 11, 7, 10, 3, 11, 8, 13, 5, 12, 7, 9, 2, 9, 7, 12, 5, 13, 8, 11, 3, 10, 7, 11, 4, 9, 5, 6, 1, 7, 6, 11, 5, 14, 9, 13, 4, 15, 11, 18, 7, 17, 10, 13, 3, 14, 11, 19, 8, 21, 13, 18, 5, 17, 12, 19
OFFSET
0,4
COMMENTS
Also called fusc(n) [Dijkstra].
a(n)/a(n+1) runs through all the reduced nonnegative rationals exactly once [Stern; Calkin and Wilf].
If the terms are written as an array:
column 0 1 2 3 4 5 6 7 8 9 ...
row 0: 0
row 1: 1
row 2: 1,2
row 3: 1,3,2,3
row 4: 1,4,3,5,2,5,3,4
row 5: 1,5,4,7,3,8,5,7,2,7,5,8,3,7,4,5
row 6: 1,6,5,9,4,11,7,10,3,11,8,13,5,12,7,9,2,9,7,12,5,13,8,11,3,10,...
...
then (ignoring row 0) the sum of the k-th row is 3^(k-1), each column is an arithmetic progression and the steps are nothing but the original sequence. - Takashi Tokita (butaneko(AT)fa2.so-net.ne.jp), Mar 08 2003
From N. J. A. Sloane, Oct 15 2017: (Start)
The above observation can be made more precise. Let A(n,k), n >= 0, 0 <= k <= 2^(n-1)-1 for k > 0, denote the entry in row n and column k of the left-justified array above.
The equations for columns 0,1,2,3,4,... are successively (ignoring row 0):
1 (n >= 1),
n (n >= 2),
n-1 (n >= 3),
2n-3 (n >= 3),
n-2 (n >= 4),
3n-7 (n >= 4),
...
and in general column k > 0 is given by
A(n,k) = a(k)*n - A156140(k) for n >= ceiling(log_2(k+1))+1, and 0 otherwise.
(End)
a(n) is the number of odd Stirling numbers S_2(n+1, 2r+1) [Carlitz].
Moshe Newman proved that the fraction a(n+1)/a(n+2) can be generated from the previous fraction a(n)/a(n+1) = x by 1/(2*floor(x) + 1 - x). The successor function f(x) = 1/(floor(x) + 1 - frac(x)) can also be used.
a(n+1) = number of alternating bit sets in n [Finch].
If f(x) = 1/(1 + floor(x) - frac(x)) then f(a(n-1)/a(n)) = a(n)/a(n+1) for n >= 1. If T(x) = -1/x and f(x) = y, then f(T(y)) = T(x) for x > 0. - Michael Somos, Sep 03 2006
a(n+1) is the number of ways of writing n as a sum of powers of 2, each power being used at most twice (the number of hyperbinary representations of n) [Carlitz; Lind].
a(n+1) is the number of partitions of the n-th integer expressible as the sum of distinct even-subscripted Fibonacci numbers (= A054204(n)), into sums of distinct Fibonacci numbers [Bicknell-Johnson, theorem 2.1].
a(n+1) is the number of odd binomial(n-k, k), 0 <= 2*k <= n. [Carlitz], corrected by Alessandro De Luca, Jun 11 2014
a(2^k) = 1. a(3*2^k) = a(2^(k+1) + 2^k) = 2. Sequences of terms between a(2^k) = 1 and a(2^(k+1)) = 1 are palindromes of length 2^k-1 with a(2^k + 2^(k-1)) = 2 in the middle. a(2^(k-1) + 1) = a(2^k - 1) = k+1 for k > 1. - Alexander Adamchuk, Oct 10 2006
The coefficients of the inverse of the g.f. of this sequence form A073469 and are related to binary partitions A000123. - Philippe Flajolet, Sep 06 2008
It appears that the terms of this sequence are the number of odd entries in the diagonals of Pascal's triangle at 45 degrees slope. - Javier Torres (adaycalledzero(AT)hotmail.com), Aug 06 2009
Let M be an infinite lower triangular matrix with (1, 1, 1, 0, 0, 0, ...) in every column shifted down twice:
1;
1, 0;
1, 1, 0;
0, 1, 0, 0;
0, 1, 1, 0, 0;
0, 0, 1, 0, 0, 0;
0, 0, 1, 1, 0, 0, 0;
...
Then this sequence A002487 (without initial 0) is the first column of lim_{n->oo} M^n. (Cf. A026741.) - Gary W. Adamson, Dec 11 2009 [Edited by M. F. Hasler, Feb 12 2017]
Member of the infinite family of sequences of the form a(n) = a(2*n); a(2*n+1) = r*a(n) + a(n+1), r = 1 for A002487 = row 1 in the array of A178239. - Gary W. Adamson, May 23 2010
Equals row 1 in an infinite array shown in A178568, sequences of the form
a(2*n) = r*a(n), a(2*n+1) = a(n) + a(n+1); r = 1. - Gary W. Adamson, May 29 2010
Row sums of A125184, the Stern polynomials. Equivalently, B(n,1), the n-th Stern polynomial evaluated at x = 1. - T. D. Noe, Feb 28 2011
The Kn1y and Kn2y triangle sums, see A180662 for their definitions, of A047999 lead to the sequence given above, e.g., Kn11(n) = A002487(n+1) - A000004(n), Kn12(n) = A002487(n+3) - A000012(n), Kn13(n) = A002487(n+5) - A000034(n+1) and Kn14(n) = A002487(n+7) - A157810(n+1). For the general case of the knight triangle sums see the Stern-Sierpiński triangle A191372. This triangle not only leads to Stern's diatomic series but also to snippets of this sequence and, quite surprisingly, their reverse. - Johannes W. Meijer, Jun 05 2011
Maximum of terms between a(2^k) = 1 and a(2^(k+1)) = 1 is the Fibonacci number F(k+2). - Leonid Bedratyuk, Jul 04 2012
Probably the number of different entries per antidiagonal of A223541. That would mean there are exactly a(n+1) numbers that can be expressed as a nim-product 2^x*2^y with x + y = n. - Tilman Piesk, Mar 27 2013
Let f(m,n) be the frequency of the integer n in the interval [a(2^(m-1)), a(2^m-1)]. Let phi(n) be Euler's totient function (A000010). Conjecture: for all integers m,n n<=m f(m,n) = phi(n). - Yosu Yurramendi, Sep 08 2014
Back in May 1995, it was proved that A000360 is the modulo 3 mapping, (+1,-1,+0)/2, of this sequence A002487 (without initial 0). - M. Jeremie Lafitte (Levitas), Apr 24 2017
Define a sequence chf(n) of Christoffel words over an alphabet {-,+}: chf(1) = '-'; chf(2*n+0) = negate(chf(n)); chf(2*n+1) = negate(concatenate(chf(n),chf(n+1))). Then the length of the chf(n) word is fusc(n) = a(n); the number of '-'-signs in the chf(n) word is c-fusc(n) = A287729(n); the number of '+'-signs in the chf(n) word is s-fusc(n) = A287730(n). See examples below. - I. V. Serov, Jun 01 2017
The sequence can be extended so that a(n) = a(-n), a(2*n) = a(n), a(2*n+1) = a(n) + a(n+1) for all n in Z. - Michael Somos, Jun 25 2019
Named after the German mathematician Moritz Abraham Stern (1807-1894), and sometimes also after the French clockmaker and amateur mathematician Achille Brocot (1817-1878). - Amiram Eldar, Jun 06 2021
It appears that a(n) is equal to the multiplicative inverse of A007305(n+1) mod A007306(n+1). For example, a(12) is 2, the multiplicative inverse of A007305(13) mod A007306(13), where A007305(13) is 4 and A007306(13) is 7. - Gary W. Adamson, Dec 18 2023
REFERENCES
M. Aigner and G. M. Ziegler, Proofs from THE BOOK, 3rd ed., Berlin, Heidelberg, New York: Springer-Verlag, 2004, p. 97.
Elwyn R. Berlekamp, John H. Conway and Richard K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 114.
Krishna Dasaratha, Laure Flapan, Chansoo Lee, Cornelia Mihaila, Nicholas Neumann-Chun, Sarah Peluse and Matthew Stroegeny, A family of multi-dimensional continued fraction Stern sequences, Abtracts Amer. Math. Soc., Vol. 33 (#1, 2012), #1077-05-2543.
Edsger W. Dijkstra, Selected Writings on Computing, Springer, 1982, p. 232 (sequence is called fusc).
F. G. M. Eisenstein, Eine neue Gattung zahlentheoretischer Funktionen, welche von zwei Elementen abhaengen und durch gewisse lineare Funktional-Gleichungen definirt werden, Verhandlungen der Koenigl. Preuss. Akademie der Wiss. Berlin (1850), pp. 36-42, Feb 18, 1850. Werke, II, pp. 705-711.
Graham Everest, Alf van der Poorten, Igor Shparlinski and Thomas Ward, Recurrence Sequences, Amer. Math. Soc., 2003; see esp. p. 255.
Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.16.3; pp. 148-149.
Ronald L. Graham, Donald E. Knuth and Oren Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 117.
Thomas Koshy, Fibonacci and Lucas numbers with applications, Wiley, 2001, p. 98.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Boris Adamczewski, Non-converging continued fractions related to the Stern diatomic sequence, Acta Arithm. 142 (1) (2010) 67-78.
Jean-Paul Allouche and Michel Mendès France, Lacunary formal power series and the Stern-Brocot sequence, arXiv preprint arXiv:1202.0211 [math.NT], 2012-2013. - N. J. A. Sloane, May 10 2012
Jean-Paul Allouche, On the Stern sequence and its twisted version, arXiv preprint arXiv:1202.4171 [math.NT], 2012.
Jean-Paul Allouche, Michel Mendès France, Anna Lubiw, Alfred J. van der Poorten and Jeffrey Shallit, Convergents of folded continued fractions.
Jean-Paul Allouche and Jeffrey Shallit, The ring of k-regular sequences, Theoretical Computer Sci., 98 (1992), 163-197. [Preprint.]
Jean-Paul Allouche and Jeffrey Shallit, The ring of k-regular sequences, II, Theoret. Computer Sci., 307 (2003), 3-29. [Preprint.]
Michael Baake and Michael Coons, A natural probability measure derived from Stern's diatomic sequence, arXiv:1706.00187 [math.NT], 2017.
Roland Bacher, Twisting the Stern sequence, arXiv:1005.5627 [math.CO], 2010.
Bruce Bates, Martin Bunder and Keith Tognetti, Linking the Calkin-Wilf and Stern-Brocot trees, Eur. J. Comb., Vol. 31, No. 7 (2010), pp. 1637-1661.
Bruce Bates and Toufik Mansour, The q-Calkin-Wilf tree, Journal of Combinatorial Theory Series A, Vol. 118, No. 3 (2011), pp. 1143-1151.
Marjorie Bicknell-Johnson, Stern's Diatomic Array Applied to Fibonacci Representations, Fibonacci Quarterly, Vol. 41 (2003), pp. 169-180.
Richard P. Brent, Michael Coons and Wadim Zudilin, Asymptotics of a Mahler Function, Slides of talk presented at AustMS/NZMS 2014, Melbourne, 8 December 2014.
Neil Calkin and Herbert S. Wilf, Recounting the rationals, Amer. Math. Monthly, Vol. 107, No. 4 (2000), pp. 360-363.
L. Carlitz, A problem in partitions related to the Stirling numbers, Bull. Amer. Math. Soc., Vol. 70, No. 2 (1964), pp. 275-278. [Abstract.]
L. Carlitz, A problem in partitions related to the Stirling numbers, Riv. Mat. Univ. Parma, (2) 5 (1964), 61-75.
Michael Coons, The transcendence of series related to Stern's diatomic sequence, International Journal of Number Theory 6.01 (2010): 211-217.
Michael Coons, On some conjectures concerning Stern's sequence and its twist, Integers 11.6 (2011): 775-789.
Michael Coons, A Correlation Identity for Stern's Sequence, Integers 12.3 (2012): 459-464.
Michael Coons and Jeffrey Shallit, A pattern sequence approach to Stern's sequence, Discrete Math., Vol. 311 (2011), pp. 2630-2633.
Michael Coons and Jason Tyler, The maximal order of Stern's diatomic sequence, arXiv:1307.1521 [math.NT], 2013-2014.
Kevin M. Courtright and James A. Sellers, Arithmetic Properties for Hyper m-ary Partitions, INTEGERS, Vol. 4 (2004), Article A6.
Valerio De Angelis, The Stern diatomic sequence via generalized Chebyshev polynomials, American Mathematical Monthly 124.5 (2017): 451-455. See also, arXiv:1511.02422 [math.NT], 2015.
Philip de Castro et al., Counting binomial coefficients divisible by a prime power, Amer. Math. Monthly, Vol. 125, No. 6 (2018), pp. 531-540. See Table p. 534.
Colin Defant, Upper Bounds for Stern's Diatomic Sequence and Related Sequences, Electronic Journal of Combinatorics, Vol. 23, No. 4 (2016), #P4.8.
Georges De Rham, Un peu de mathématiques à propos d'une courbe plane, Elemente der Math., Vol. 2 (1947), pp. 73-76 and 89-97.
Marc Deléglise, Paul Erdős and Jean-Louis Nicolas, Sur les ensembles représentés par les partitions d'un entier n [Sets represented by partitions of an integer n] Paul Erdős memorial collection. Discrete Math., Vol. 200, No. 1-3 (1999), pp. 27-48. MR1692277 (2000e:05012). See Table 1. N. J. A. Sloane, Mar 18 2012
Edsger W. Dijkstra, More about the function "fusc".
Karl Dilcher and Larry Ericksen, Hyperbinary expansions and Stern polynomials, Elec. J. Combin, Vol. 22 (2015), #P2.24.
Karl Dilcher and Larry Ericksen, Factors and irreducibility of generalized Stern polynomials, Integers, Vol. 15 (2015), #A50.
Karl Dilcher and Larry Ericksen, Continued fractions and Stern polynomials, Ramanujan Journal, Vol. 45 (2017), pp. 659-681.
Karl Dilcher and Larry Ericksen, Polynomials Characterizing Hyper b-ary Representations, J. Int. Seq., Vol. 21 (2018), Article 18.4.3.
Karl Dilcher and Larry Ericksen, Polynomial Analogues of Restricted b-ary Partition Functions, J. Int. Seq., Vol. 22 (2019), Article 19.3.2.
Tom Edgar, On the number of hyper m-ary partitions, Integers, Vol. 18 (2018), Article #A47.
De-Jun Feng, Pierre Liardet and Alain Thomas, Partition functions in numeration systems with bounded multiplicity, Uniform Distribution Theory, Vol. 9, No. 1 (2014).
Steven R. Finch, P. Sebah and Z.-Q. Bai, Odd Entries in Pascal's Trinomial Triangle, arXiv:0802.2654 [math.NT], 2008.
Aviezri S. Fraenkel, Ratwyt, Dec 28 2011.
Thomas Garrity, A multi-dimensional continued fraction generalization of Stern's diatomic sequence, arXiv:1206.6685 [math.CO], 2012-2013.
Thomas Garrity, A multi-dimensional continued fraction generalization of Stern's diatomic sequence, Journal of Integer Sequences, Vol. 16 (2013), #13.7.7.
Jose Grimm, Implementation of Bourbaki's Elements of Mathematics in Coq: Part Two, From Natural Numbers to Real Numbers, Journal of Formalized Reasoning, Vol. 9, No. 2 (2016), pp. 1-52; see p. 38.
Brian Hayes, On the Teeth of Wheels, American Scientist, Vol. 88, No. 4 (July-August 2000), pp. 296-300 (5 pages).
Andreas M. Hinz, Sandi Klavžar, Uroš Milutinović and Ciril Petr,, The Tower of Hanoi - Myths and Maths, Birkhäuser 2013. See page 115. Book's website
Andreas M. Hinz, Sandi Klavžar, Uroš Milutinović, Daniele Parisse and Ciril Petr, Metric properties of the Tower of Hanoi graphs and Stern's diatomic sequence European J. Combin., Vol. 26, No. 5 (2005), pp. 693-708.
Donald E. Knuth, C. P. Rupert, Alex Smith and Richard Stong, Recounting the Rationals, Continued: 10906, solution by Moshe Newman, American Mathematical Monthly, Vol. 110, No. 7 (2003), pp. 642-643.
Jennifer Lansing, Distribution of Values of the Binomial Coefficients and the Stern Sequence, Journal of Integer Sequences, Vol. 16 (2013), Article 13.3.7.
Jennifer Lansing, Largest Values for the Stern Sequence, Journal of Integer Sequences, Vol. 17 (2014), Article 14.7.5.
D. H. Lehmer, On Stern's Diatomic Series, Amer. Math. Monthly, Vol. 36, No. 1 (1929), pp. 59-67. [Annotated and corrected scanned copy.]
Julien Leroy, Michel Rigo and Manon Stipulanti, Counting the number of non-zero coefficients in rows of generalized Pascal triangles, Discrete Mathematics, Vol. 340 (2017), pp. 862-881. Also available at Université de Liège.
Alan J. Macfarlane, Linear reversible second-order cellular automata and their first-order matrix equivalents, Journal of Physics A: Mathematical and General 37.45 (2004): 10791. See Fig. 2.
Sam Northshield, Stern's diatomic sequence 0, 1, 1, 2, 1, 3, 2, 3, 1, 4, ..., Amer. Math. Monthly, Vol. 117, No. 7 (2010), pp. 581-598.
Sam Northshield, An Analogue of Stern's Sequence for Z[sqrt(2)], Journal of Integer Sequences, Vol. 18 (2015), Article 15.11.6.
Sam Northshield, Re^3counting the Rationals, arXiv:1905.10369 [math.NT], 2019.
Bruce Reznick, Some binary partition functions, in "Analytic number theory" (Conf. in honor P. T. Bateman, Allerton Park, IL, 1989), Progr. Math., 85, Birkhäuser Boston, Boston, MA, 1990, pp. 451-477.
Bruce Reznick, Regularity properties of the Stern enumeration of the Rationals, Journal of Integer Sequences, Vol. 11 (2008) Article 08.4.1.
Jürgen W. Sander, Jörn Steuding and Rasa Steuding, Diophantine aspects of the Calkin-Wilf iteration, El. Math., Vol. 66, No. 2 (2011) pp. 45-55. doi:10.4171/EM/170.
Anton Shakov, Polynomials in Z[x] whose divisors are enumerated by SL_2(N_0), arXiv:2405.03552 [math.NT], 2024. See p. 27.
N. J. A. Sloane, Stern-Brocot or Farey Tree.
N. J. A. Sloane and Brady Haran, Amazing Graphs III, Numberphile video (2019).
Richard P. Stanley and Herbert S. Wilf, Refining the Stern Diatomic Sequence, unpublished.
Richard P. Stanley and Herbert S. Wilf, Refining the Stern Diatomic Sequence [Cached copy, with permission]
Jörn Steuding, Stefanie Hofmann and Gertraud Schuster, Euclid, Calkin & Wilf - playing with rationals, Elemente der Mathematik, Vol. 63, No. 3 (2008), pp. 109-117.
Ralf Stephan, Divide-and-conquer generating functions. I. Elementary sequences, arXiv:math/0307027 [math.CO], 2003.
M. A. Stern, Über eine zahlentheoretische Funktion, J. Reine Angew. Math., Vol. 55 (1858), pp. 193-220.
Maciej Ulas and Oliwia Ulas, On certain arithmetic properties of Stern polynomials, arXiv:1102.5109 [math.CO], 2011.
Eric Weisstein's World of Mathematics, Calkin-Wilf Tree and Stern's Diatomic Series.
Yasuhisa Yamada, A function from Stern's diatomic sequence, and its properties, arXiv:2004.00278 [math.NT], 2020.
FORMULA
a(n+1) = (2*k+1)*a(n) - a(n-1) where k = floor(a(n-1)/a(n)). - David S. Newman, Mar 04 2001
Let e(n) = A007814(n) = exponent of highest power of 2 dividing n. Then a(n+1) = (2k+1)*a(n)-a(n-1), n > 0, where k = e(n). Moreover, floor(a(n-1)/a(n)) = e(n), in agreement with D. Newman's formula. - Dragutin Svrtan (dsvrtan(AT)math.hr) and Igor Urbiha (urbiha(AT)math.hr), Jan 10 2002
Calkin and Wilf showed 0.9588 <= limsup a(n)/n^(log(phi)/log(2)) <= 1.1709 where phi is the golden mean. Does this supremum limit = 1? - Benoit Cloitre, Jan 18 2004. Coons and Tyler show the limit is A246765 = 0.9588... - Kevin Ryde, Jan 09 2021
a(n) = Sum_{k=0..floor((n-1)/2)} (binomial(n-k-1, k) mod 2). - Paul Barry, Sep 13 2004
a(n) = Sum_{k=0..n-1} (binomial(k, n-k-1) mod 2). - Paul Barry, Mar 26 2005
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = v^3 + 2*u*v*w - u^2*w. - Michael Somos, May 02 2005
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^3), A(x^6)) where f(u1, u2, u3, u6) = u1^3*u6 - 3*u1^2*u2*u6 + 3*u2^3*u6 - u2^3*u3. - Michael Somos, May 02 2005
G.f.: x * Product_{k>=0} (1 + x^(2^k) + x^(2^(k+1))) [Carlitz].
a(n) = a(n-2) + a(n-1) - 2*(a(n-2) mod a(n-1)). - Mike Stay, Nov 06 2006
A079978(n) = (1 + e^(i*Pi*A002487(n)))/2, i=sqrt(-1). - Paul Barry, Jan 14 2005
a(n) = Sum_{k=1..n} K(k, n-k)*a(n - k), where K(n,k) = 1 if 0 <= k AND k <= n AND n-k <= 2 and K(n,k) = 0 else. (When using such a K-coefficient, several different arguments to K or several different definitions of K may lead to the same integer sequence. For example, if we drop the condition k <= n in the above definition, then we arrive at A002083 = Narayana-Zidek-Capell numbers.) - Thomas Wieder, Jan 13 2008
a(k+1)*a(2^n - k) - a(k)*a(2^n - (k+1)) = 1; a(2^n - k) + a(k) = a(2^(n+1) + k). Both formulas hold for 0 <= k <= 2^n - 1. G.f.: G(z) = a(1) + a(2)*z + a(3)*z^2 + ... + a(k+1)*z^k + ... Define f(z) = (1 + z + z^2), then G(z) = lim f(z)*f(z^2)*f(z^4)* ... *f(z^(2^n))*... = (1 + z + z^2)*G(z^2). - Arie Werksma (werksma(AT)tiscali.nl), Apr 11 2008
a(k+1)*a(2^n - k) - a(k)*a(2^n - (k+1)) = 1 (0 <= k <= 2^n - 1). - Arie Werksma (werksma(AT)tiscali.nl), Apr 18 2008
a(2^n + k) = a(2^n - k) + a(k) (0 <= k <= 2^n). - Arie Werksma (werksma(AT)tiscali.nl), Apr 18 2008
Let g(z) = a(1) + a(2)*z + a(3)*z^2 + ... + a(k+1)*z^k + ..., f(z) = 1 + z + z^2. Then g(z) = lim_{n->infinity} f(z)*f(z^2)*f(z^4)*...*f(z^(2^n)), g(z) = f(z)*g(z^2). - Arie Werksma (werksma(AT)tiscali.nl), Apr 18 2008
For 0 <= k <= 2^n - 1, write k = b(0) + 2*b(1) + 4*b(2) + ... + 2^(n-1)*b(n-1) where b(0), b(1), etc. are 0 or 1. Define a 2 X 2 matrix X(m) with entries x(1,1) = x(2,2) = 1, x(1,2) = 1 - b(m), x(2,1) = b(m). Let P(n)= X(0)*X(1)* ... *X(n-1). The entries of the matrix P are members of the sequence: p(1,1) = a(k+1), p(1,2) = a(2^n - (k+1)), p(2,1) = a(k), p(2,2) = a(2^n - k). - Arie Werksma (werksma(AT)tiscali.nl), Apr 20 2008
Let f(x) = A030101(x); if 2^n + 1 <= x <= 2^(n + 1) and y = 2^(n + 1) - f(x - 1) then a(x) = a(y). - Arie Werksma (Werksma(AT)Tiscali.nl), Jul 11 2008
a(n) = A126606(n + 1) / 2. - Reikku Kulon, Oct 05 2008
Equals infinite convolution product of [1,1,1,0,0,0,0,0,0] aerated A000079 - 1 times, i.e., [1,1,1,0,0,0,0,0,0] * [1,0,1,0,1,0,0,0,0] * [1,0,0,0,1,0,0,0,1]. - Mats Granvik and Gary W. Adamson, Oct 02 2009; corrected by Mats Granvik, Oct 10 2009
a(2^(p+2)*n+2^(p+1)-1) - a(2^(p+1)*n+2^p-1) = A007306(n+1), p >= 0 and n >= 0. - Johannes W. Meijer, Feb 07 2013
a(2*n-1) = A007306(n), n > 0. - Yosu Yurramendi, Jun 23 2014
a(n*2^m) = a(n), m>0, n > 0. - Yosu Yurramendi, Jul 03 2014
a(k+1)*a(2^m+k) - a(k)*a(2^m+(k+1)) = 1 for m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Nov 07 2014
a(2^(m+1)+(k+1))*a(2^m+k) - a(2^(m+1)+k)*a(2^m+(k+1)) = 1 for m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Nov 07 2014
a(5*2^k) = 3. a(7*2^k) = 3. a(9*2^k) = 4. a(11*2^k) = 5. a(13*2^k) = 5. a(15*2^k) = 4. In general: a((2j-1)*2^k) = A007306(j), j > 0, k >= 0 (see Adamchuk's comment). - Yosu Yurramendi, Mar 05 2016
a(2^m+2^m'+k') = a(2^m'+k')*(m-m'+1) - a(k'), m >= 0, m' <= m-1, 0 <= k' < 2^m'. - Yosu Yurramendi, Jul 13 2016
From Yosu Yurramendi, Jul 13 2016: (Start)
Let n be a natural number and [b_m b_(m-1) ... b_1 b_0] its binary expansion with b_m=1.
Let L = Sum_{i=0..m} b_i be the number of binary digits equal to 1 (L >= 1).
Let {m_j: j=1..L} be the set of subindices such that b_m_j = 1, j=1..L, and 0 <= m_1 <= m_2 <= ... <= m_L = m.
If L = 1 then c_1 = 1, otherwise let {c_j: j=1..(L-1)} be the set of coefficients such that c_(j) = m_(j+1) - m_j + 1, 1 <= j <= L-1.
Let f be a function defined on {1..L+1} such that f(1) = 0, f(2) = 1, f(j) = c_(j-2)*f(j-1) - f(j-2), 3 <= j <= L+1.
Then a(n) = f(L+1) (see example). (End)
a(n) = A001222(A260443(n)) = A000120(A277020(n)). Also a(n) = A000120(A101624(n-1)) for n >= 1. - Antti Karttunen, Nov 05 2016
(a(n-1) + a(n+1))/a(n) = A037227(n) for n >= 1. - Peter Bala, Feb 07 2017
a(0) = 0; a(3n) = 2*A000360(3n-1); a(3n+1) = 2*A000360(3n) - 1; a(3n+2) = 2*A000360(3n+1) + 1. - M. Jeremie Lafitte (Levitas), Apr 24 2017
From I. V. Serov, Jun 14 2017: (Start)
a(n) = A287896(n-1) - 1*A288002(n-1) for n > 1;
a(n) = A007306(n-1) - 2*A288002(n-1) for n > 1. (End)
From Yosu Yurramendi, Feb 14 2018: (Start)
a(2^(m+2) + 2^(m+1) + k) - a(2^(m+1) + 2^m + k) = 2*a(k), m >= 0, 0 <= k < 2^m.
a(2^(m+2) + 2^(m+1) + k) - a(2^(m+1) + k) = a(2^m + k), m >= 0, 0 <= k < 2^m.
a(2^m + k) = a(k)*(m - floor(log_2(k)) - 1) + a(2^(floor(log_2(k))+1) + k), m >= 0, 0 < k < 2^m, a(2^m) = 1, a(0) = 0. (End)
From Yosu Yurramendi, May 08 2018: (Start)
a(2^m) = 1, m >= 0.
a(2^r*(2*k+1)) = a(2^r*(2*k)) + a(2^r*(2*k+2)), r < - m - floor(log_2(k)) - 1, m > 0, 1 <= k < 2^m. (End)
Trow(n) = [card({k XOR j-k): k=0..j}) for j = 2^(n-1)-1..2^n-2] when regarded as an irregular table (n >= 1). - Peter Luschny, Sep 29 2024
EXAMPLE
Stern's diatomic array begins:
1,1,
1,2,1,
1,3,2,3,1,
1,4,3,5,2,5,3,4,1,
1,5,4,7,3,8,5,7,2,7,5,8,3,7,4,5,1,
1,6,5,9,4,11,7,10,3,11,8,13,5,12,7,9,2,9,7,12,5,13,8,11,3,10,7,11,4,9,...
...
a(91) = 19, because 91_10 = 1011011_2; b_6=b_4=b_3=b_1=b_0=1, b_5=b_2=0; L=5; m_1=0, m_2=1, m_3=3, m_4=4, m_5=6; c_1=2, c_2=3, c_3=2, c_4=3; f(1)=1, f(2)=2, f(3)=5, f(4)=8, f(5)=19. - Yosu Yurramendi, Jul 13 2016
From I. V. Serov, Jun 01 2017: (Start)
a(n) is the length of the Christoffel word chf(n):
n chf(n) A070939(n) a(n)
1 '-' 1 1
2 '+' 2 1
3 '+-' 2 2
4 '-' 3 1
5 '--+' 3 3
6 '-+' 3 2
... (End)
G.f. = x + x^2 + 2*x^3 + x^4 + 3*x^5 + 2*x^6 + 3*x^7 + x^8 + ... - Michael Somos, Jun 25 2019
MAPLE
A002487 := proc(n) option remember; if n <= 1 then n elif n mod 2 = 0 then procname(n/2); else procname((n-1)/2)+procname((n+1)/2); fi; end: seq(A002487(n), n=0..91);
A002487 := proc(m) local a, b, n; a := 1; b := 0; n := m; while n>0 do if type(n, odd) then b := a+b else a := a+b end if; n := floor(n/2); end do; b; end proc: seq(A002487(n), n=0..91); # Program adapted from E. Dijkstra, Selected Writings on Computing, Springer, 1982, p. 232. - Igor Urbiha (urbiha(AT)math.hr), Oct 28 2002. Since A007306(n) = a(2*n+1), this program can be adapted for A007306 by replacing b := 0 by b := 1.
A002487 := proc(n::integer) local k; option remember; if n = 0 then 0 elif n=1 then 1 else add(K(k, n-1-k)*procname(n - k), k = 1 .. n) end if end proc:
K := proc(n::integer, k::integer) local KC; if 0 <= k and k <= n and n-k <= 2 then KC:=1; else KC:= 0; end if; end proc: seq(A002487(n), n=0..91); # Thomas Wieder, Jan 13 2008
# next Maple program:
a:= proc(n) option remember; `if`(n<2, n,
(q-> a(q)+(n-2*q)*a(n-q))(iquo(n, 2)))
end:
seq(a(n), n=0..100); # Alois P. Heinz, Feb 11 2021
fusc := proc(n) local a, b, c; a := 1; b := 0;
for c in convert(n, base, 2) do
if c = 0 then a := a + b else b := a + b fi od;
b end:
seq(fusc(n), n = 0..91); # Peter Luschny, Nov 09 2022
Stern := proc(n, u) local k, j, b;
b := j -> nops({seq(Bits:-Xor(k, j-k), k = 0..j)}):
ifelse(n=0, 1-u, seq(b(j), j = 2^(n-1)-1..2^n-1-u)) end:
seq(print([n], Stern(n, 1)), n = 0..5); # As shown in the comments.
seq(print([n], Stern(n, 0)), n = 0..5); # As shown in the examples. # Peter Luschny, Sep 29 2024
MATHEMATICA
a[0] = 0; a[1] = 1; a[n_] := If[ EvenQ[n], a[n/2], a[(n-1)/2] + a[(n+1)/2]]; Table[ a[n], {n, 0, 100}] (* end of program *)
Onemore[l_] := Transpose[{l, l + RotateLeft[l]}] // Flatten;
NestList[Onemore, {1}, 5] // Flatten (*gives [a(1), ...]*) (* Takashi Tokita, Mar 09 2003 *)
ToBi[l_] := Table[2^(n - 1), {n, Length[l]}].Reverse[l]; Map[Length,
Split[Sort[Map[ToBi, Table[IntegerDigits[n - 1, 3], {n, 500}]]]]] (*give [a(1), ...]*) (* Takashi Tokita, Mar 10 2003 *)
A002487[m_] := Module[{a = 1, b = 0, n = m}, While[n > 0, If[OddQ[n], b = a+b, a = a+b]; n = Floor[n/2]]; b]; Table[A002487[n], {n, 0, 100}] (* Jean-François Alcover, Sep 06 2013, translated from 2nd Maple program *)
a[0] = 0; a[1] = 1;
Flatten[Table[{a[2*n] = a[n], a[2*n + 1] = a[n] + a[n + 1]}, {n, 0, 50}]] (* Horst H. Manninger, Jun 09 2021 *)
nmax = 100; CoefficientList[Series[x*Product[(1 + x^(2^k) + x^(2^(k+1))), {k, 0, Floor[Log[2, nmax]] + 1}], {x, 0, nmax}], x] (* Vaclav Kotesovec, Oct 08 2022 *)
PROG
(PARI) {a(n) = n=abs(n); if( n<2, n>0, a(n\2) + if( n%2, a(n\2 + 1)))};
(PARI) fusc(n)=local(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); b \\ Charles R Greathouse IV, Oct 05 2008
(PARI) A002487(n, a=1, b=0)=for(i=0, logint(n, 2), if(bittest(n, i), b+=a, a+=b)); b \\ M. F. Hasler, Feb 12 2017, updated Feb 14 2019
(Haskell)
a002487 n = a002487_list !! n
a002487_list = 0 : 1 : stern [1] where
stern fuscs = fuscs' ++ stern fuscs' where
fuscs' = interleave fuscs $ zipWith (+) fuscs $ (tail fuscs) ++ [1]
interleave [] ys = ys
interleave (x:xs) ys = x : interleave ys xs
-- Reinhard Zumkeller, Aug 23 2011
(R)
N <- 50 # arbitrary
a <- 1
for (n in 1:N)
{
a[2*n ] = a[n]
a[2*n + 1] = a[n] + a[n+1]
a
}
a
# Yosu Yurramendi, Oct 04 2014
(Scheme)
;; An implementation of memoization-macro definec can be found for example in: http://oeis.org/wiki/Memoization
(definec (A002487 n) (cond ((<= n 1) n) ((even? n) (A002487 (/ n 2))) (else (+ (A002487 (/ (- n 1) 2)) (A002487 (/ (+ n 1) 2))))))
;; Antti Karttunen, Nov 05 2016
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def a(n): return n if n<2 else a(n//2) if n%2==0 else a((n - 1)//2) + a((n + 1)//2) # Indranil Ghosh, Jun 08 2017; corrected by Reza K Ghazi, Dec 27 2021
(Python)
def a(n):
a, b = 1, 0
while n > 0:
if n & 1:
b += a
else:
a += b
n >>= 1
return b
# Reza K Ghazi, Dec 29 2021
(Sage)
def A002487(n):
M = [1, 0]
for b in n.bits():
M[b] = M[0] + M[1]
return M[1]
print([A002487(n) for n in (0..91)])
# For a dual see A174980. Peter Luschny, Nov 28 2017
(Julia)
using Nemo
function A002487List(len)
a, A = QQ(0), [0, 1]
for n in 1:len
a = next_calkin_wilf(a)
push!(A, denominator(a))
end
A end
A002487List(91) |> println # Peter Luschny, Mar 13 2018
(R) # Given n, compute a(n) by taking into account the binary representation of n
a <- function(n){
b <- as.numeric(intToBits(n))
l <- sum(b)
m <- which(b == 1)-1
d <- 1
if(l > 1) for(j in 1:(l-1)) d[j] <- m[j+1]-m[j]+1
f <- c(0, 1)
if(l > 1) for(j in 3:(l+1)) f[j] <- d[j-2]*f[j-1]-f[j-2]
return(f[l+1])
} # Yosu Yurramendi, Dec 13 2016
(R) # computes the sequence as a vector A, rather than function a() as above.
A <- c(1, 1)
maxlevel <- 5 # by choice
for(m in 1:maxlevel) {
A[2^(m+1)] <- 1
for(k in 1:(2^m-1)) {
r <- m - floor(log2(k)) - 1
A[2^r*(2*k+1)] <- A[2^r*(2*k)] + A[2^r*(2*k+2)]
}}
A # Yosu Yurramendi, May 08 2018
(Magma) [&+[(Binomial(k, n-k-1) mod 2): k in [0..n]]: n in [0..100]]; // Vincenzo Librandi, Jun 18 2019
(Python)
def A002487(n): return sum(int(not (n-k-1) & ~k) for k in range(n)) # Chai Wah Wu, Jun 19 2022
CROSSREFS
Record values are in A212289.
If the 1's are replaced by pairs of 1's we obtain A049456.
Inverse: A020946.
Cf. a(A001045(n)) = A000045(n). a(A062092(n)) = A000032(n+1).
Cf. A064881-A064886 (Stern-Brocot subtrees).
A column of A072170.
Cf. A049455 for the 0,1 version of Stern's diatomic array.
Cf. A000119, A262097 for analogous sequences in other bases and A277189, A277315, A277328 for related sequences with similar graphs.
Cf. A086592 and references therein to other sequences related to Kepler's tree of fractions.
KEYWORD
nonn,easy,nice,core,look
EXTENSIONS
Additional references and comments from Len Smiley, Joshua Zucker, Rick L. Shepherd and Herbert S. Wilf
Typo in definition corrected by Reinhard Zumkeller, Aug 23 2011
Incorrect formula deleted and text edited by Johannes W. Meijer, Feb 07 2013
STATUS
approved
Unary-encoded compressed factorization of natural numbers.
+10
372
0, 1, 2, 3, 4, 5, 8, 7, 6, 9, 16, 11, 32, 17, 10, 15, 64, 13, 128, 19, 18, 33, 256, 23, 12, 65, 14, 35, 512, 21, 1024, 31, 34, 129, 20, 27, 2048, 257, 66, 39, 4096, 37, 8192, 67, 22, 513, 16384, 47, 24, 25, 130, 131, 32768, 29, 36, 71, 258, 1025, 65536, 43, 131072, 2049, 38, 63, 68, 69, 262144
OFFSET
1,3
COMMENTS
The primes become the powers of 2 (2 -> 1, 3 -> 2, 5 -> 4, 7 -> 8); the composite numbers are formed by taking the values for the factors in the increasing order, multiplying them by the consecutive powers of 2, and summing. See the Example section.
From Antti Karttunen, Jun 27 2014: (Start)
The odd bisection (containing even terms) halved gives A244153.
The even bisection (containing odd terms), when one is subtracted from each and halved, gives this sequence back.
(End)
Question: Are there any other solutions that would satisfy the recurrence r(1) = 0; and for n > 1, r(n) = Sum_{d|n, d>1} 2^A033265(r(d)), apart from simple variants 2^k * A156552(n)? See also A297112, A297113. - Antti Karttunen, Dec 30 2017
FORMULA
From Antti Karttunen, Jun 26 2014: (Start)
a(1) = 0, a(n) = A000079(A001222(n)+A061395(n)-2) + a(A052126(n)).
a(1) = 0, a(2n) = 1+2*a(n), a(2n+1) = 2*a(A064989(2n+1)). [Compare to the entanglement recurrence A243071].
For n >= 0, a(2n+1) = 2*A244153(n+1). [Follows from the latter clause of the above formula.]
a(n) = A005941(n) - 1.
As a composition of related permutations:
a(n) = A003188(A243354(n)).
a(n) = A054429(A243071(n)).
For all n >= 1, A005940(1+a(n)) = n and for all n >= 0, a(A005940(n+1)) = n. [The offset-0 version of A005940 works as an inverse for this permutation.]
This permutations also maps between the partition-lists A112798 and A125106:
A056239(n) = A161511(a(n)). [The sums of parts of each partition (the total sizes).]
A003963(n) = A243499(a(n)). [And also the products of those parts.]
(End)
From Antti Karttunen, Oct 09 2016: (Start)
A161511(a(n)) = A056239(n).
A029837(1+a(n)) = A252464(n). [Binary width of terms.]
A080791(a(n)) = A252735(n). [Number of nonleading 0-bits.]
A000120(a(n)) = A001222(n). [Binary weight.]
For all n >= 2, A001511(a(n)) = A055396(n).
For all n >= 2, A000120(a(n))-1 = A252736(n). [Binary weight minus one.]
A252750(a(n)) = A252748(n).
a(A250246(n)) = A252754(n).
a(A005117(n)) = A277010(n). [Maps squarefree numbers to a permutation of A003714, fibbinary numbers.]
A085357(a(n)) = A008966(n). [Ditto for their characteristic functions.]
For all n >= 0:
a(A276076(n)) = A277012(n).
a(A276086(n)) = A277022(n).
a(A260443(n)) = A277020(n).
(End)
From Antti Karttunen, Dec 30 2017: (Start)
For n > 1, a(n) = Sum_{d|n, d>1} 2^A033265(a(d)). [See comments.]
More linking formulas:
A106737(a(n)) = A000005(n).
A290077(a(n)) = A000010(n).
A069010(a(n)) = A001221(n).
A136277(a(n)) = A181591(n).
A132971(a(n)) = A008683(n).
A106400(a(n)) = A008836(n).
A268411(a(n)) = A092248(n).
A037011(a(n)) = A010052(n) [conjectured, depends on the exact definition of A037011].
A278161(a(n)) = A046951(n).
A001316(a(n)) = A061142(n).
A277561(a(n)) = A034444(n).
A286575(a(n)) = A037445(n).
A246029(a(n)) = A181819(n).
A278159(a(n)) = A124859(n).
A246660(a(n)) = A112624(n).
A246596(a(n)) = A069739(n).
A295896(a(n)) = A053866(n).
A295875(a(n)) = A295297(n).
A284569(a(n)) = A072411(n).
A286574(a(n)) = A064547(n).
A048735(a(n)) = A292380(n).
A292272(a(n)) = A292382(n).
A244154(a(n)) = A048673(n), a(A064216(n)) = A244153(n).
A279344(a(n)) = A279339(n), a(A279338(n)) = A279343(n).
a(A277324(n)) = A277189(n).
A037800(a(n)) = A297155(n).
For n > 1, A033265(a(n)) = 1+A297113(n).
(End)
From Antti Karttunen, Mar 08 2019: (Start)
a(n) = A048675(n) + A323905(n).
a(A324201(n)) = A000396(n), provided there are no odd perfect numbers.
The following sequences are derived from or related to the base-2 expansion of a(n):
A000265(a(n)) = A322993(n).
A002487(a(n)) = A323902(n).
A005187(a(n)) = A323247(n).
A324288(a(n)) = A324116(n).
A323505(a(n)) = A323508(n).
A079559(a(n)) = A323512(n).
A085405(a(n)) = A323239(n).
The following sequences are obtained by applying to a(n) a function that depends on the prime factorization of its argument, which goes "against the grain" because a(n) is the binary code of the factorization of n, which in these cases is then factored again:
A000203(a(n)) = A323243(n).
A033879(a(n)) = A323244(n) = 2*a(n) - A323243(n),
A294898(a(n)) = A323248(n).
A000005(a(n)) = A324105(n).
A000010(a(n)) = A324104(n).
A083254(a(n)) = A324103(n).
A001227(a(n)) = A324117(n).
A000593(a(n)) = A324118(n).
A001221(a(n)) = A324119(n).
A009194(a(n)) = A324396(n).
A318458(a(n)) = A324398(n).
A192895(a(n)) = A324100(n).
A106315(a(n)) = A324051(n).
A010052(a(n)) = A324822(n).
A053866(a(n)) = A324823(n).
A001065(a(n)) = A324865(n) = A323243(n) - a(n),
A318456(a(n)) = A324866(n) = A324865(n) OR a(n),
A318457(a(n)) = A324867(n) = A324865(n) XOR a(n),
A318458(a(n)) = A324398(n) = A324865(n) AND a(n),
A318466(a(n)) = A324819(n) = A323243(n) OR 2*a(n),
A318467(a(n)) = A324713(n) = A323243(n) XOR 2*a(n),
A318468(a(n)) = A324815(n) = A323243(n) AND 2*a(n).
(End)
EXAMPLE
For 84 = 2*2*3*7 -> 1*1 + 1*2 + 2*4 + 8*8 = 75.
For 105 = 3*5*7 -> 2*1 + 4*2 + 8*4 = 42.
For 137 = p_33 -> 2^32 = 4294967296.
For 420 = 2*2*3*5*7 -> 1*1 + 1*2 + 2*4 + 4*8 + 8*16 = 171.
For 147 = 3*7*7 = p_2 * p_4 * p_4 -> 2*1 + 8*2 + 8*4 = 50.
MATHEMATICA
Table[Floor@ Total@ Flatten@ MapIndexed[#1 2^(#2 - 1) &, Flatten[ Table[2^(PrimePi@ #1 - 1), {#2}] & @@@ FactorInteger@ n]], {n, 67}] (* Michael De Vlieger, Sep 08 2016 *)
PROG
(Perl)
# Program corrected per instructions from Leonid Broukhis. - Antti Karttunen, Jun 26 2014
# However, it gives correct answers only up to n=136, before corruption by a wrap-around effect.
# Note that the correct answer for n=137 is A156552(137) = 4294967296.
$max = $ARGV[0];
$pow = 0;
foreach $i (2..$max) {
@a = split(/ /, `factor $i`);
shift @a;
$shift = 0;
$cur = 0;
while ($n = int shift @a) {
$prime{$n} = 1 << $pow++ if !defined($prime{$n});
$cur |= $prime{$n} << $shift++;
}
print "$cur, ";
}
print "\n";
(Scheme, with memoization-macro definec from Antti Karttunen's IntSeq-library, two different implementations)
(definec (A156552 n) (cond ((= n 1) 0) (else (+ (A000079 (+ -2 (A001222 n) (A061395 n))) (A156552 (A052126 n))))))
(definec (A156552 n) (cond ((= 1 n) (- n 1)) ((even? n) (+ 1 (* 2 (A156552 (/ n 2))))) (else (* 2 (A156552 (A064989 n))))))
;; Antti Karttunen, Jun 26 2014
(PARI) a(n) = {my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res}; \\ David A. Corneth, Mar 08 2019
(PARI)
A064989(n) = {my(f); f = factor(n); if((n>1 && f[1, 1]==2), f[1, 2] = 0); for (i=1, #f~, f[i, 1] = precprime(f[i, 1]-1)); factorback(f)};
A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n)))); \\ (based on the given recurrence) - Antti Karttunen, Mar 08 2019
(Python)
from sympy import primepi, factorint
def A156552(n): return sum((1<<primepi(p)-1)<<i for i, p in enumerate(factorint(n, multiple=True))) # Chai Wah Wu, Mar 10 2023
CROSSREFS
One less than A005941.
Inverse permutation: A005940 with starting offset 0 instead of 1.
Cf. also A297106, A297112 (Möbius transform), A297113, A153013, A290308, A300827, A323243, A323244, A323247, A324201, A324812 (n for which a(n) is a square), A324813, A324822, A324823, A324398, A324713, A324815, A324819, A324865, A324866, A324867.
KEYWORD
easy,base,nonn
AUTHOR
Leonid Broukhis, Feb 09 2009
EXTENSIONS
More terms from Antti Karttunen, Jun 28 2014
STATUS
approved
Odd bisection of A260443 (the even terms): a(n) = A260443((2*n)+1).
+10
20
2, 6, 18, 30, 90, 270, 450, 210, 630, 6750, 20250, 9450, 15750, 47250, 22050, 2310, 6930, 330750, 3543750, 1653750, 4961250, 53156250, 24806250, 727650, 1212750, 57881250, 173643750, 18191250, 8489250, 25467750, 2668050, 30030, 90090, 40020750, 1910081250, 891371250, 9550406250, 455814843750, 212713593750
OFFSET
0,1
COMMENTS
From David A. Corneth, Oct 22 2016: (Start)
The exponents of the prime factorization of a(n) are first nondecreasing, then nonincreasing.
The exponent of 2 in the prime factorization of a(n) is 1. (End)
LINKS
FORMULA
a(n) = A260443((2*n)+1).
a(0) = 2; for n >= 1, a(n) = A260443(n) * A260443(n+1).
Other identities. For all n >= 0:
A007949(a(n)) = A005811(n). [See comments in A125184.]
A156552(a(n)) = A277189(n), a(n) = A005940(1+A277189(n)).
A048675(a(n)) = 2n + 1. - David A. Corneth, Oct 22 2016
A001222(a(n)) = A007306(1+n).
A056169(a(n)) = A284267(n).
A275812(a(n)) = A284268(n).
A248663(a(n)) = A283975(n).
A000188(a(n)) = A283484(n).
A247503(a(n)) = A284563(n).
A248101(a(n)) = A284564(n).
A046523(a(n)) = A284573(n).
a(n) = A277198(n) * A284008(n).
a(n) = A284576(n) * A284578(n) = A284577(n) * A000290(A284578(n)).
EXAMPLE
A method to find terms of this sequence, explained by an example to find a(7). To find k = a(7), we find k such that A048675(k) = 2*7+1 = 15. 7 has the binary partitions: {[7, 0, 0], [5, 1, 0], [3, 2, 0], [1, 3, 0], [3, 0, 1], [1, 1, 1]}. To each of those, we prepend a 1. This gives the binary partitions of 15 starting with a 1. For example, for the first we get [1, 7, 0, 0]. We see that only [1, 5, 1, 0], [1, 3, 2, 0] and [1, 1, 1, 1] start nondecreasing, then nonincreasing, so we only check those. These numbers will be the exponents in a prime factorization. [1, 5, 1, 0] corresponds to prime(1)^1 * prime(2)^5 * prime(3)^1 * prime(4)^0 = 2430. We find that [1, 1, 1, 1] gives k = 210 for which A048675(k) = 15 so a(7) = 210. - David A. Corneth, Oct 22 2016
MATHEMATICA
a[n_] := a[n] = Which[n < 2, n + 1, EvenQ@ n, Times @@ Map[#1^#2 & @@ # &, FactorInteger[#] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[# == 1] &@ a[n/2], True, a[#] a[# + 1] &[(n - 1)/2]]; Table[a[2 n + 1], {n, 0, 38}] (* Michael De Vlieger, Apr 05 2017 *)
PROG
(Scheme, two versions)
(define (A277324 n) (A260443 (+ 1 n n)))
(define (A277324 n) (if (zero? n) 2 (* (A260443 n) (A260443 (+ 1 n)))))
(Python)
from sympy import factorint, prime, primepi
from operator import mul
def a003961(n):
F=factorint(n)
return 1 if n==1 else reduce(mul, [prime(primepi(i) + 1)**F[i] for i in F])
def a260443(n): return n + 1 if n<2 else a003961(a260443(n//2)) if n%2==0 else a260443((n - 1)//2)*a260443((n + 1)//2)
def a(n): return a260443(2*n + 1)
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 21 2017
CROSSREFS
Cf. A277200 (same sequence sorted into ascending order).
KEYWORD
nonn
AUTHOR
Antti Karttunen, Oct 10 2016
EXTENSIONS
More linking formulas added by Antti Karttunen, Apr 16 2017
STATUS
approved
Unary-binary representation of Stern polynomials: a(n) = A156552(A260443(n)).
+10
10
0, 1, 2, 5, 4, 13, 10, 21, 8, 45, 26, 93, 20, 109, 42, 85, 16, 173, 90, 477, 52, 957, 186, 733, 40, 749, 218, 1501, 84, 877, 170, 341, 32, 685, 346, 3549, 180, 12221, 954, 7133, 104, 14269, 1914, 49021, 372, 28605, 1466, 5853, 80, 5869, 1498, 30685, 436, 61373, 3002, 23517, 168, 12013, 1754, 24029, 340, 7021, 682, 1365
OFFSET
0,3
COMMENTS
Sequence encodes Stern polynomials (see A125184, A260443) with "unary-binary method" where any nonzero coefficient c > 0 is encoded as a run of c 1-bits, separated from neighboring 1-runs by exactly one zero (this follows because A260442 is a subsequence of A073491). See the examples.
Terms which are not multiples of 4 form a subset of A003754, or in other words, each term is 2^k * {a term from a certain subsequence of A247648}, which subsequence remains to be determined.
FORMULA
a(n) = A156552(A260443(n)).
Other identities. For all n >= 0:
A087808(a(n)) = n.
A000120(a(n)) = A002487(n).
a(2n) = 2*a(n).
a(2^n) = 2^n.
a(A000225(n)) = A002450(n).
EXAMPLE
n Stern polynomial Encoded as a(n)
"unary-binary" number (-> decimal)
----------------------------------------------------------------
0 B_0(x) = 0 "0" 0
1 B_1(x) = 1 "1" 1
2 B_2(x) = x "10" 2
3 B_3(x) = x + 1 "101" 5
4 B_4(x) = x^2 "100" 4
5 B_5(x) = 2x + 1 "1101" 13
6 B_6(x) = x^2 + x "1010" 10
7 B_7(x) = x^2 + x + 1 "10101" 21
8 B_8(x) = x^3 "1000" 8
9 B_9(x) = x^2 + 2x + 1 "101101" 45
PROG
(Scheme)
(define (A277020 n) (A156552 (A260443 n)))
;; Another implementation, more practical to run:
(define (A277020 n) (list_of_numbers_to_unary_binary_representation (A260443as_index_lists n)))
(definec (A260443as_index_lists n) (cond ((zero? n) (list)) ((= 1 n) (list 1)) ((even? n) (cons 0 (A260443as_index_lists (/ n 2)))) (else (add_two_lists (A260443as_index_lists (/ (- n 1) 2)) (A260443as_index_lists (/ (+ n 1) 2))))))
(define (add_two_lists nums1 nums2) (let ((len1 (length nums1)) (len2 (length nums2))) (cond ((< len1 len2) (add_two_lists nums2 nums1)) (else (map + nums1 (append nums2 (make-list (- len1 len2) 0)))))))
(define (list_of_numbers_to_unary_binary_representation nums) (let loop ((s 0) (nums nums) (b 1)) (cond ((null? nums) s) (else (loop (+ s (* (A000225 (car nums)) b)) (cdr nums) (* (A000079 (+ 1 (car nums))) b))))))
CROSSREFS
Cf. A087808 (a left inverse), A156552, A260443, A277189 (odd bisection).
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Oct 07 2016
STATUS
approved

Search completed in 0.074 seconds