cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 11 results. Next

A000027 The positive integers. Also called the natural numbers, the whole numbers or the counting numbers, but these terms are ambiguous.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77
Offset: 1

Views

Author

Keywords

Comments

For some authors, the terms "natural numbers" and "counting numbers" include 0, i.e., refer to the nonnegative integers A001477; the term "whole numbers" frequently also designates the whole set of (signed) integers A001057.
a(n) is smallest positive integer which is consistent with sequence being monotonically increasing and satisfying a(a(n)) = n (cf. A007378).
Inverse Euler transform of A000219.
The rectangular array having A000027 as antidiagonals is the dispersion of the complement of the triangular numbers, A000217 (which triangularly form column 1 of this array). The array is also the transpose of A038722. - Clark Kimberling, Apr 05 2003
For nonzero x, define f(n) = floor(nx) - floor(n/x). Then f=A000027 if and only if x=tau or x=-tau. - Clark Kimberling, Jan 09 2005
Numbers of form (2^i)*k for odd k (i.e., n = A006519(n)*A000265(n)); thus n corresponds uniquely to an ordered pair (i,k) where i=A007814, k=A000265 (with A007814(2n)=A001511(n), A007814(2n+1)=0). - Lekraj Beedassy, Apr 22 2006
If the offset were changed to 0, we would have the following pattern: a(n)=binomial(n,0) + binomial(n,1) for the present sequence (number of regions in 1-space defined by n points), A000124 (number of regions in 2-space defined by n straight lines), A000125 (number of regions in 3-space defined by n planes), A000127 (number of regions in 4-space defined by n hyperplanes), A006261, A008859, A008860, A008861, A008862 and A008863, where the last six sequences are interpreted analogously and in each "... by n ..." clause an offset of 0 has been assumed, resulting in a(0)=1 for all of them, which corresponds to the case of not cutting with a hyperplane at all and therefore having one region. - Peter C. Heinig (algorithms(AT)gmx.de), Oct 19 2006
Define a number of points on a straight line to be in general arrangement when no two points coincide. Then these are the numbers of regions defined by n points in general arrangement on a straight line, when an offset of 0 is assumed. For instance, a(0)=1, since using no point at all leaves one region. The sequence satisfies the recursion a(n) = a(n-1) + 1. This has the following geometrical interpretation: Suppose there are already n-1 points in general arrangement, thus defining the maximal number of regions on a straight line obtainable by n-1 points, and now one more point is added in general arrangement. Then it will coincide with no other point and act as a dividing wall thereby creating one new region in addition to the a(n-1)=(n-1)+1=n regions already there, hence a(n)=a(n-1)+1. Cf. the comments on A000124 for an analogous interpretation. - Peter C. Heinig (algorithms(AT)gmx.de), Oct 19 2006
The sequence a(n)=n (for n=1,2,3) and a(n)=n+1 (for n=4,5,...) gives to the rank (minimal cardinality of a generating set) for the semigroup I_n\S_n, where I_n and S_n denote the symmetric inverse semigroup and symmetric group on [n]. - James East, May 03 2007
The sequence a(n)=n (for n=1,2), a(n)=n+1 (for n=3) and a(n)=n+2 (for n=4,5,...) gives the rank (minimal cardinality of a generating set) for the semigroup PT_n\T_n, where PT_n and T_n denote the partial transformation semigroup and transformation semigroup on [n]. - James East, May 03 2007
"God made the integers; all else is the work of man." This famous quotation is a translation of "Die ganzen Zahlen hat der liebe Gott gemacht, alles andere ist Menschenwerk," spoken by Leopold Kronecker in a lecture at the Berliner Naturforscher-Versammlung in 1886. Possibly the first publication of the statement is in Heinrich Weber's "Leopold Kronecker," Jahresberichte D.M.V. 2 (1893) 5-31. - Clark Kimberling, Jul 07 2007
Binomial transform of A019590, inverse binomial transform of A001792. - Philippe Deléham, Oct 24 2007
Writing A000027 as N, perhaps the simplest one-to-one correspondence between N X N and N is this: f(m,n) = ((m+n)^2 - m - 3n + 2)/2. Its inverse is given by I(k)=(g,h), where g = k - J(J-1)/2, h = J + 1 - g, J = floor((1 + sqrt(8k - 7))/2). Thus I(1)=(1,1), I(2)=(1,2), I(3)=(2,1) and so on; the mapping I fills the first-quadrant lattice by successive antidiagonals. - Clark Kimberling, Sep 11 2008
a(n) is also the mean of the first n odd integers. - Ian Kent, Dec 23 2008
Equals INVERTi transform of A001906, the even-indexed Fibonacci numbers starting (1, 3, 8, 21, 55, ...). - Gary W. Adamson, Jun 05 2009
These are also the 2-rough numbers: positive integers that have no prime factors less than 2. - Michael B. Porter, Oct 08 2009
Totally multiplicative sequence with a(p) = p for prime p. Totally multiplicative sequence with a(p) = a(p-1) + 1 for prime p. - Jaroslav Krizek, Oct 18 2009
Triangle T(k,j) of natural numbers, read by rows, with T(k,j) = binomial(k,2) + j = (k^2-k)/2 + j where 1 <= j <= k. In other words, a(n) = n = binomial(k,2) + j where k is the largest integer such that binomial(k,2) < n and j = n - binomial(k,2). For example, T(4,1)=7, T(4,2)=8, T(4,3)=9, and T(4,4)=10. Note that T(n,n)=A000217(n), the n-th triangular number. - Dennis P. Walsh, Nov 19 2009
Hofstadter-Conway-like sequence (see A004001): a(n) = a(a(n-1)) + a(n-a(n-1)) with a(1) = 1, a(2) = 2. - Jaroslav Krizek, Dec 11 2009
a(n) is also the dimension of the irreducible representations of the Lie algebra sl(2). - Leonid Bedratyuk, Jan 04 2010
Floyd's triangle read by rows. - Paul Muljadi, Jan 25 2010
Number of numbers between k and 2k where k is an integer. - Giovanni Teofilatto, Mar 26 2010
Generated from a(2n) = r*a(n), a(2n+1) = a(n) + a(n+1), r = 2; in an infinite set, row 2 of the array shown in A178568. - Gary W. Adamson, May 29 2010
1/n = continued fraction [n]. Let barover[n] = [n,n,n,...] = 1/k. Then k - 1/k = n. Example: [2,2,2,...] = (sqrt(2) - 1) = 1/k, with k = (sqrt(2) + 1). Then 2 = k - 1/k. - Gary W. Adamson, Jul 15 2010
Number of n-digit numbers the binary expansion of which contains one run of 1's. - Vladimir Shevelev, Jul 30 2010
From Clark Kimberling, Jan 29 2011: (Start)
Let T denote the "natural number array A000027":
1 2 4 7 ...
3 5 8 12 ...
6 9 13 18 ...
10 14 19 25 ...
T(n,k) = n+(n+k-2)*(n+k-1)/2. See A185787 for a list of sequences based on T, such as rows, columns, diagonals, and sub-arrays. (End)
The Stern polynomial B(n,x) evaluated at x=2. See A125184. - T. D. Noe, Feb 28 2011
The denominator in the Maclaurin series of log(2), which is 1 - 1/2 + 1/3 - 1/4 + .... - Mohammad K. Azarian, Oct 13 2011
As a function of Bernoulli numbers B_n (cf. A027641: (1, -1/2, 1/6, 0, -1/30, 0, 1/42, ...)): let V = a variant of B_n changing the (-1/2) to (1/2). Then triangle A074909 (the beheaded Pascal's triangle) * [1, 1/2, 1/6, 0, -1/30, ...] = the vector [1, 2, 3, 4, 5, ...]. - Gary W. Adamson, Mar 05 2012
Number of partitions of 2n+1 into exactly two parts. - Wesley Ivan Hurt, Jul 15 2013
Integers n dividing u(n) = 2u(n-1) - u(n-2); u(0)=0, u(1)=1 (Lucas sequence A001477). - Thomas M. Bridge, Nov 03 2013
For this sequence, the generalized continued fraction a(1)+a(1)/(a(2)+a(2)/(a(3)+a(3)/(a(4)+...))), evaluates to 1/(e-2) = A194807. - Stanislav Sykora, Jan 20 2014
Engel expansion of e-1 (A091131 = 1.71828...). - Jaroslav Krizek, Jan 23 2014
a(n) is the number of permutations of length n simultaneously avoiding 213, 231 and 321 in the classical sense which are breadth-first search reading words of increasing unary-binary trees. For more details, see the entry for permutations avoiding 231 at A245898. - Manda Riehl, Aug 05 2014
a(n) is also the number of permutations simultaneously avoiding 213, 231 and 321 in the classical sense which can be realized as labels on an increasing strict binary tree with 2n-1 nodes. See A245904 for more information on increasing strict binary trees. - Manda Riehl, Aug 07 2014
a(n) = least k such that 2*Pi - Sum_{h=1..k} 1/(h^2 - h + 3/16) < 1/n. - Clark Kimberling, Sep 28 2014
a(n) = least k such that Pi^2/6 - Sum_{h=1..k} 1/h^2 < 1/n. - Clark Kimberling, Oct 02 2014
Determinants of the spiral knots S(2,k,(1)). a(k) = det(S(2,k,(1))). These knots are also the torus knots T(2,k). - Ryan Stees, Dec 15 2014
As a function, the restriction of the identity map on the nonnegative integers {0,1,2,3...}, A001477, to the positive integers {1,2,3,...}. - M. F. Hasler, Jan 18 2015
See also A131685(k) = smallest positive number m such that c(i) = m (i^1 + 1) (i^2 + 2) ... (i^k+ k) / k! takes integral values for all i>=0: For k=1, A131685(k)=1, which implies that this is a well defined integer sequence. - Alexander R. Povolotsky, Apr 24 2015
a(n) is the number of compositions of n+2 into n parts avoiding the part 2. - Milan Janjic, Jan 07 2016
Does not satisfy Benford's law [Berger-Hill, 2017] - N. J. A. Sloane, Feb 07 2017
Parametrization for the finite multisubsets of the positive integers, where, for p_j the j-th prime, n = Product_{j} p_j^(e_j) corresponds to the multiset containing e_j copies of j ('Heinz encoding' -- see A056239, A003963, A289506, A289507, A289508, A289509). - Christopher J. Smyth, Jul 31 2017
The arithmetic function v_1(n,1) as defined in A289197. - Robert Price, Aug 22 2017
For n >= 3, a(n)=n is the least area that can be obtained for an irregular octagon drawn in a square of n units side, whose sides are parallel to the axes, with 4 vertices that coincide with the 4 vertices of the square, and the 4 remaining vertices having integer coordinates. See Affaire de Logique link. - Michel Marcus, Apr 28 2018
a(n+1) is the order of rowmotion on a poset defined by a disjoint union of chains of length n. - Nick Mayers, Jun 08 2018
Number of 1's in n-th generation of 1-D Cellular Automata using Rules 50, 58, 114, 122, 178, 186, 206, 220, 238, 242, 250 or 252 in the Wolfram numbering scheme, started with a single 1. - Frank Hollstein, Mar 25 2019
(1, 2, 3, 4, 5, ...) is the fourth INVERT transform of (1, -2, 3, -4, 5, ...). - Gary W. Adamson, Jul 15 2019

References

  • T. M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 1.
  • T. M. Apostol, Modular Functions and Dirichlet Series in Number Theory, Springer-Verlag, 1990, page 25.
  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 22.
  • W. Fulton and J. Harris, Representation theory: a first course, (1991), page 149. [From Leonid Bedratyuk, Jan 04 2010]
  • I. S. Gradstein and I. M. Ryshik, Tables of series, products, and integrals, Volume 1, Verlag Harri Deutsch, 1981.
  • R. E. Schwartz, You Can Count on Monsters: The First 100 numbers and Their Characters, A. K. Peters and MAA, 2010.
  • 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).

Crossrefs

A001477 = nonnegative numbers.
Partial sums of A000012.
Cf. A026081 = integers in reverse alphabetical order in U.S. English, A107322 = English name for number and its reverse have the same number of letters, A119796 = zero through ten in alphabetical order of English reverse spelling, A005589, etc. Cf. A185787 (includes a list of sequences based on the natural number array A000027).
Cf. Boustrophedon transforms: A000737, A231179;
Cf. A038722 (mirrored when seen as triangle), A056011 (boustrophedon).
Cf. A048993, A048994, A000110 (see the Feb 03 2015 formula).

Programs

Formula

a(2k+1) = A005408(k), k >= 0, a(2k) = A005843(k), k >= 1.
Multiplicative with a(p^e) = p^e. - David W. Wilson, Aug 01 2001
Another g.f.: Sum_{n>0} phi(n)*x^n/(1-x^n) (Apostol).
When seen as an array: T(k, n) = n+1 + (k+n)*(k+n+1)/2. Main diagonal is 2n*(n+1)+1 (A001844), antidiagonal sums are n*(n^2+1)/2 (A006003). - Ralf Stephan, Oct 17 2004
Dirichlet generating function: zeta(s-1). - Franklin T. Adams-Watters, Sep 11 2005
G.f.: x/(1-x)^2. E.g.f.: x*exp(x). a(n)=n. a(-n)=-a(n).
Series reversion of g.f. A(x) is x*C(-x)^2 where C(x) is the g.f. of A000108. - Michael Somos, Sep 04 2006
G.f. A(x) satisfies 0 = f(A(x), A(x^2)) where f(u, v) = u^2 - v - 4*u*v. - Michael Somos, Oct 03 2006
Convolution of A000012 (the all-ones sequence) with itself. - Tanya Khovanova, Jun 22 2007
a(n) = 2*a(n-1)-a(n-2); a(1)=1, a(2)=2. a(n) = 1+a(n-1). - Philippe Deléham, Nov 03 2008
a(n) = A000720(A000040(n)). - Juri-Stepan Gerasimov, Nov 29 2009
a(n+1) = Sum_{k=0..n} A101950(n,k). - Philippe Deléham, Feb 10 2012
a(n) = Sum_{d | n} phi(d) = Sum_{d | n} A000010(d). - Jaroslav Krizek, Apr 20 2012
G.f.: x * Product_{j>=0} (1+x^(2^j))^2 = x * (1+2*x+x^2) * (1+2*x^2+x^4) * (1+2*x^4+x^8) * ... = x + 2x^2 + 3x^3 + ... . - Gary W. Adamson, Jun 26 2012
a(n) = det(binomial(i+1,j), 1 <= i,j <= n). - Mircea Merca, Apr 06 2013
E.g.f.: x*E(0), where E(k) = 1 + 1/(x - x^3/(x^2 + (k+1)/E(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Aug 03 2013
From Wolfdieter Lang, Oct 09 2013: (Start)
a(n) = Product_{k=1..n-1} 2*sin(Pi*k/n), n > 1.
a(n) = Product_{k=1..n-1} (2*sin(Pi*k/(2*n)))^2, n > 1.
These identities are used in the calculation of products of ratios of lengths of certain lines in a regular n-gon. For the first identity see the Gradstein-Ryshik reference, p. 62, 1.392 1., bringing the first factor there to the left hand side and taking the limit x -> 0 (L'Hôpital). The second line follows from the first one. Thanks to Seppo Mustonen who led me to consider n-gon lengths products. (End)
a(n) = Sum_{j=0..k} (-1)^(j-1)*j*binomial(n,j)*binomial(n-1+k-j,k-j), k>=0. - Mircea Merca, Jan 25 2014
a(n) = A052410(n)^A052409(n). - Reinhard Zumkeller, Apr 06 2014
a(n) = Sum_{k=1..n^2+2*n} 1/(sqrt(k)+sqrt(k+1)). - Pierre CAMI, Apr 25 2014
a(n) = floor(1/sin(1/n)) = floor(cot(1/(n+1))) = ceiling(cot(1/n)). - Clark Kimberling, Oct 08 2014
a(n) = floor(1/(log(n+1)-log(n))). - Thomas Ordowski, Oct 10 2014
a(k) = det(S(2,k,1)). - Ryan Stees, Dec 15 2014
a(n) = 1/(1/(n+1) + 1/(n+1)^2 + 1/(n+1)^3 + ...). - Pierre CAMI, Jan 22 2015
a(n) = Sum_{m=0..n-1} Stirling1(n-1,m)*Bell(m+1), for n >= 1. This corresponds to Bell(m+1) = Sum_{k=0..m} Stirling2(m, k)*(k+1), for m >= 0, from the fact that Stirling2*Stirling1 = identity matrix. See A048993, A048994 and A000110. - Wolfdieter Lang, Feb 03 2015
a(n) = Sum_{k=1..2n-1}(-1)^(k+1)*k*(2n-k). In addition, surprisingly, a(n) = Sum_{k=1..2n-1}(-1)^(k+1)*k^2*(2n-k)^2. - Charlie Marion, Jan 05 2016
G.f.: x/(1-x)^2 = (x * r(x) *r(x^3) * r(x^9) * r(x^27) * ...), where r(x) = (1 + x + x^2)^2 = (1 + 2x + 3x^2 + 2x^3 + x^4). - Gary W. Adamson, Jan 11 2017
a(n) = floor(1/(Pi/2-arctan(n))). - Clark Kimberling, Mar 11 2020
a(n) = Sum_{d|n} mu(n/d)*sigma(d). - Ridouane Oudra, Oct 03 2020
a(n) = Sum_{k=1..n} phi(gcd(n,k))/phi(n/gcd(n,k)). - Richard L. Ollerton, May 09 2021
a(n) = S(n-1, 2), with the Chebyshev S-polynomials A049310. - Wolfdieter Lang, Mar 09 2023
From Peter Bala, Nov 02 2024: (Start)
For positive integer m, a(n) = (1/m)* Sum_{k = 1..2*m*n-1} (-1)^(k+1) * k * (2*m*n - k) = (1/m) * Sum_{k = 1..2*m*n-1} (-1)^(k+1) * k^2 * (2*m*n - k)^2 (the case m = 1 is given above).
a(n) = Sum_{k = 0..3*n} (-1)^(n+k+1) * k * binomial(3*n+k, 2*k). (End)

Extensions

Links edited by Daniel Forgues, Oct 07 2009.

A006165 a(1) = a(2) = 1; thereafter a(2n+1) = a(n+1) + a(n), a(2n) = 2a(n).

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 8, 8, 8, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43
Offset: 1

Views

Author

Keywords

Comments

a(n+1) is the second-order survivor of the n-person Josephus problem where every second person is marked until only one remains, who is then eliminated; the process is repeated from the beginning until all but one is eliminated. a(n) is first a power of 2 when n is three times a power of 2. For example, the first appearances of 2, 4, 8 and 16 are at positions 3, 6, 12 and 24, or (3*1),(3*2),(3*4) and (3*8). Eugene McDonnell (eemcd(AT)aol.com), Jan 19 2002, reporting on work of Boyko Bantchev (Bulgaria).
Appears to coincide with following sequence: Let n >= 1. Start with a bag B containing n 1's. At each step, replace the two least elements x and y in B with the single element x+y. Repeat until B contains 2 or fewer elements. Let a(n) be the largest element remaining in B at this point. - David W. Wilson, Jul 01 2003
Hsien-Kuei Hwang, S Janson, TH Tsai (2016) show that A078881 is the same sequence, apart from the offset. - N. J. A. Sloane, Nov 26 2017

Examples

			From _Peter Bala_, Aug 01 2022: (Start)
1) The sequence {n - a(a(n)) : n >= 1} begins [0, 1, 2, 3, 3, 4, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12, 12, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, ...] has the repeated values 3 (twice), 6 (three times), 12 (five times), 24 (nine times), 48 (seventeen times) ..., conjecturally of the form 3*2^m
2) The sequence {n - a(a(a(n))) : n >= 1} begins [0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 28, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, ...] has the repeated values 7 (twice), 14 (three times), 28 (five times), 56 (nine times) ..., conjecturally of the form 7*2^m. (End)
		

References

  • J. Arkin, D. C. Arney, L. S. Dewald and W. E. Ebel, Jr., Families of recursive sequences, J. Rec. Math., 22 (No. 22, 1990), 85-94.
  • Hsien-Kuei Hwang, S Janson, TH Tsai, Exact and asymptotic solutions of the recurrence f(n) = f(floor(n/2)) + f(ceiling(n/2)) + g(n): theory and applications, Preprint, 2016; http://140.109.74.92/hk/wp-content/files/2016/12/aat-hhrr-1.pdf. Also Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    a := proc (n) option remember; if n = 1 then 1 else n - a(n - a(a(n-1))) end if end proc: seq(a(n), n = 1..100); # Peter Bala, Jul 31 2022
  • Mathematica
    t = {1, 1}; Do[If[OddQ[n], AppendTo[t, t[[Floor[n/2]]] + t[[Ceiling[n/2]]]], AppendTo[t, 2*t[[n/2]]]], {n, 3, 128}] (* T. D. Noe, May 25 2011 *)
  • PARI
    a(n) = my(i=logint(n,2)-1); if(bittest(n,i), 2<Kevin Ryde, Aug 06 2022
    
  • PARI
    a(n)=if(n<2,1,n-a(n-a(n\2))); \\ Benoit Cloitre, May 12 2024
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A006165(n): return 1 if n <= 2 else A006165(n//2) + A006165((n+1)//2) # Chai Wah Wu, Mar 08 2022
    
  • Python
    def A006165(n): return min(n-(m:=1<1 else 1 # Chai Wah Wu, Oct 22 2024
    

Formula

For n >= 2, if a(n) >= A006257(n), i.e., if msb(n) > n - a(n)/2, then a(n+1) = a(n)+1, otherwise a(n+1) = a(n). - Henry Bottomley, Jan 21 2002
a(n+1) = min(msb(n), 1+n-msb(n)/2) for all n (msb = most significant bit, A053644). - Boyko Bantchev (bantchev(AT)math.bas.bg), May 17 2002
a(1)=1, a(n) = n - a(n - a(a(n-1))). - Benoit Cloitre, Nov 08 2002
a(1)=1, a(n) = n - a(n - a(floor(n/2))). - Benoit Cloitre, May 12 2024
For k > 0, 0 <= i <= 2^k-1, a(2^k+i) = 2^(k-1)+i; for 2^k-2^(k-2) <= x <= 2^k a(x) = 2^(k-1); (also a(m*2^k) = a(m)*2^k for m >= 2). - Benoit Cloitre, Dec 16 2002
G.f.: x * (1/(1+x) + (1/(1-x)^2) * Sum_{k>=0} t^2*(1-t)) where t = x^2^k. - Ralf Stephan, Sep 12 2003
a(n) = A005942(n+1)/2 - n = n - A060973(n) = 2n - A007378(n). - Ralf Stephan, Sep 13 2003
a(n) = A080776(n-1) + A060937(n). - Ralf Stephan
From Peter Bala, Jul 31 2022: (Start)
For k a positive integer, define the k-th iterated sequence a^(k) of a by a^(1)(n) = a(n) and setting a^(k)(n) = a^(k-1)(a(n)) for k >= 2. For example, a^(2)(n) = a(a(n)) and a^(3)(n) = a(a(a(n))).
Conjectures: for n >= 2 there holds
(i) a(n) + a(n - a(n - a(n - a(n - a(n))))) = n;
(ii) a(n - a(n - a(n - a(n)))) = a(n - a(n - a(n - a(n - a(n - a(n))))));
(iii) a^2(n) = a(n - a(n - a(n - a(n))));
(iv) n - a(n) = a(n - a^(2)(n));
(v) a(n - a(n)) = a^(2)(n - a^(2)(n - a^(2)(n - a^(2)(n))));
(vi) for k >= 2, a^(k)(n - a^(k)(n)) = a^(k)(n - a^(k)(n - a^(k)(n - a^(k)(n)))).
(vii) for k >= 1, the sequence {n - a^(k)(n) : n >= 1} has first differences either 0 or 1. We conjecture that the repeated values of the sequence are of the form (2^k - 1)*2^m. The number of repeated values appears to always be 2, 3, 5, 9, 17, 35, ..., independent of k, conjecturally A000051. Two examples are given below.
A similar property may hold for the sequences {n - A060973^(k)(n) : n >= 2^(k-1)}, k = 1,2,3,.... (End)

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Jun 12 2002

A003605 Unique monotonic sequence of nonnegative integers satisfying a(a(n)) = 3n.

Original entry on oeis.org

0, 2, 3, 6, 7, 8, 9, 12, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120
Offset: 0

Views

Author

Keywords

Comments

Another definition: a(0) = 0, a(1) = 2; for n > 1, a(n) is taken to be the smallest positive integer greater than a(n-1) which is consistent with the condition "n is a member of the sequence if and only if a(n) is a multiple of 3". - Benoit Cloitre, Feb 14 2003
Yet another definition: a(0) = 0, a(1)=2; for n > 1, a(n) is the smallest integer > a(n-1) satisfying "if n is in the sequence, a(n)==0 (mod 3)" ("only if" omitted).
This sequence is the case m = 2 of the following family: a(1, m) = m, a(n, m) is the smallest integer > a(n-1, m) satisfying "if n is in the sequence, a(n, m) == 0 (mod (2m-1))". The general formula is: for any k >= 0, for j = -m*(2m-1)^k, ..., -1, 0, 1, ..., m*(2m-1)^k, a((m-1)*(2*m-1)^k+j) = (2*m-1)^(k+1)+m*j+(m-1)*abs(j).
Numbers whose base-3 representation starts with 2 or ends with 0. - Franklin T. Adams-Watters, Jan 17 2006
This sequence was the subject of the 5th problem of the 27th British Mathematical Olympiad in 1992 (see link British Mathematical Olympiad, reference Gardiner's book and second example for the answer to the BMO question). - Bernard Schott, Dec 25 2020

Examples

			9 is in the sequence and the smallest multiple of 3 greater than a(9-1)=a(8)=15 is 18. Hence a(9)=18.
a(1992) = a(2*3^6+534) = 3^7+3*534 = 3789 (answer to B.M.O. problem).
		

References

  • A. Gardiner, The Mathematical Olympiad Handbook: An Introduction to Problem Solving, Oxford University Press, 1997, reprinted 2011, pages 5 and 113-114 (1992).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Unique monotonic sequence of positive integers satisfying a(a(n)) = k*(n-1) + 3: A080637 (k=2), this sequence (k=3), A353651 (k=4), A353652 (k=5), A353653 (k=6).

Programs

  • Maple
    filter:= n ->  (n mod 3 = 0) or (n >= 2*3^floor(log[3](n))):
    select(filter, [$0..1000]); # Robert Israel, Oct 15 2014
  • Mathematica
    a[n_] := a[n] = Which[ Mod[n, 3] == 0, 3 a[n/3], Mod[n, 3] == 1, 2*a[(n-1)/3] + a[(n-1)/3 + 1], True, a[(n-2)/3] + 2*a[(n-2)/3 + 1]]; a[0]=0; a[1]=2; a[2]=3; Table[a[n], {n, 0, 67}] (* Jean-François Alcover, Jul 18 2012, after Michael Somos *)
  • PARI
    a(n)=if(n<3,n+(n>0),(3-(n%3))*a(n\3)+(n%3)*a(n\3+1))
    
  • PARI
    {A(n)=local(d,w,l3=log(3),l2=log(2),l3n);
               l3n = log(n)/l3;
               w   = floor(l3n);         \\ highest exponent w such that 3^w <= n
               d   = frac(l3n)*l3/l2+1;  \\ first digit in base-3 repr. of n
                  if ( d<2 , d=1 , d=2 );\\   make d an integer either 1 or 2
               if(d==1, n = n + 3^w , n = (n - 3^w)*3);
               return(n);}
    \\ Gottfried Helms, Jan 11 2012
    
  • Python
    from sympy import integer_log
    def A003605(n): return max(n+(m:=3**integer_log(n,3)[0]),3*(n-m)) if n else 0  # Chai Wah Wu, Feb 03 2025

Formula

For any k>=0, a(3^k - j) = 2*3^k - 3j, 0 <= j <= 3^(k-1); a(3^k + j) = 2*3^k + j, 0 <= j <= 3^k.
From Michael Somos, May 03 2000: (Start)
a(3*n) = 3*a(n), a(3*n+1) = 2*a(n) + a(n+1), a(3*n+2) = a(n) + 2a(n+1), n > 0.
a(n+1) - 2*a(n) + a(n-1) = {2 if n=3^k, -2 if n=2*3^k, otherwise 0}, n > 1. (End)
a(n) = n + A006166(n). - Vladeta Jovovic, Mar 01 2003
a(n) = abs(2*3^floor(log_3(n)) - n) + 2n - 3^floor(log_3(n)) for n>=1. - Theodore Lamort de Gail, Sep 12 2017
For any k >= 0, a(2*3^k + j) = 3^(k+1) + 3*j, 0 <= j <= 3^k. - Bernard Schott, Dec 25 2020

A080637 a(n) is the smallest positive integer which is consistent with the sequence being monotonically increasing and satisfying a(1)=2, a(a(n)) = 2n+1 for n > 1.

Original entry on oeis.org

2, 3, 5, 6, 7, 9, 11, 12, 13, 14, 15, 17, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 96, 97, 98, 99, 100, 101, 102
Offset: 1

Views

Author

N. J. A. Sloane and Benoit Cloitre, Feb 28 2003

Keywords

Comments

Sequence is the unique monotonic sequence satisfying a(a(n)) = 2n+1.
Except for the first term, numbers (greater than 2) whose binary representation starts with 11 or ends with 1. - Yifan Xie, May 26 2022

Examples

			From _Yifan Xie_, May 02 2022: (Start)
a(8) = 12 because 2*2^2 <= 8 < 3*2^2, hence a(8) = 8 + 2^2 = 12;
a(13) = 19 because 3*2^2 <= 13 < 4*2^2, hence a(13) = 2*(13 - 2^2) + 1 = 19. (End)
		

Crossrefs

Except for first term, same as A079905. Cf. A079000.
A007378, A079905, A080637, A080653 are all essentially the same sequence.
Equals A007378(n+1)-1. First differences give A079882.
Unique monotonic sequence of positive integers satisfying a(a(n)) = k*(n-1) + 3: this sequence (k=2), A003605 (k=3), A353651 (k=4), A353652 (k=5), A353653 (k=6).

Programs

  • Maple
    t := []; for k from 0 to 6 do for j from -2^k to 2^k-1 do t := [op(t), 4*2^k - 1 + 3*j/2 + abs(j)/2]; od: od: t;
  • Mathematica
    b[n_] := b[n] = If[n<4, n+1, If[OddQ[n], b[(n-1)/2+1]+b[(n-1)/2], 2b[n/2]]];
    a[n_] := b[n+1]-1;
    a /@ Range[70] (* Jean-François Alcover, Oct 31 2019 *)

Formula

a(3*2^k - 1 + j) = 4*2^k - 1 + 3*j/2 + |j|/2 for k >= 0, -2^k <= j < 2^k.
a(2n+1) = 2*a(n) + 1, a(2n) = a(n) + a(n-1) + 1.
From Yifan Xie, May 02 2022: (Start)
For n in the range 2*2^i <= n < 3*2^i, for i >= 0:
a(n) = n + 2^i.
a(n) = 1 + a(n-1).
Otherwise, for n in the range 3*2^i <= n < 4*2^i, for i >= 0:
a(n) = 2*(n - 2^i) + 1.
a(n) = 2 + a(n-1). (End)

A079905 a(1)=1; then a(n) is smallest positive integer which is consistent with sequence being monotonically increasing and satisfying a(a(n)) = 2n+1 for n>1.

Original entry on oeis.org

1, 3, 5, 6, 7, 9, 11, 12, 13, 14, 15, 17, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 96, 97, 98, 99, 100, 101, 102
Offset: 1

Views

Author

N. J. A. Sloane, Feb 21 2003

Keywords

Comments

Alternate definition: a(n) is taken to be smallest positive integer greater than a(n-1) such that the condition "a(a(n)) is always odd" can be satisfied. - Matthew Vandermast, Mar 03 2003
Also: a(n)=smallest positive integer > a(n-1) such that the condition "n is in the sequence if and only if a(n) is even" is false; that is, the condition "either n is not in the sequence and a(n) is odd or n is in the sequence and a(n) is even" is satisfied. - Matthew Vandermast, Mar 05 2003

Crossrefs

See A080637 for a nicer version. Cf. A079000.
Equals A007378(n+1)-1, n>1.
A007378, A079905, A080637, A080653 are all essentially the same sequence.
Union of A079946 and A005408 (the odd numbers).

Programs

Formula

a(1)=1, a(2)=3, then a(3*2^k - 1 + j) = 4*2^k - 1 + 3j/2 + |j|/2 for k >= 1, -2^k <= j < 2^k.
a(n) = 1+A079945(n-1)-A079944(n-1) for n>1, a(1)=1. - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 23 2003

Extensions

More terms from Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 23 2003

A080653 a(1) = 2; for n>1, a(n) is taken to be the smallest integer greater than a(n-1) such that the condition "a(a(n)) is always even" is satisfied.

Original entry on oeis.org

2, 4, 5, 6, 8, 10, 11, 12, 13, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 34, 36, 38, 40, 42, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 95, 96, 97
Offset: 1

Views

Author

Matthew Vandermast, Mar 01 2003

Keywords

Comments

Also defined by: a(n) = smallest positive number > a(n-1) such that the condition "n is in sequence if and only if a(n) is odd" is false (cf. A079000); that is, the condition "either n is not in the sequence and a(n) is odd or n is in the sequence and a(n) is even" is satisfied.
If prefixed with a(0) = 0, can be defined by: a(n) = smallest nonnegative number > a(n-1) such that the condition "n is in sequence only if a(n) is even" is satisfied.
Lower density 2/3, upper density 3/4. - Charles R Greathouse IV, Dec 14 2022

References

  • Hsien-Kuei Hwang, S Janson, TH Tsai, Exact and asymptotic solutions of the recurrence f(n) = f(floor(n/2)) + f(ceiling(n/2)) + g(n): theory and applications, Preprint, 2016; http://140.109.74.92/hk/wp-content/files/2016/12/aat-hhrr-1.pdf. Also Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585

Crossrefs

Equals A007378 - 2.
A007378, A079905, A080637, A080653 are all essentially the same sequence.

Programs

  • Mathematica
    (* b = A007378 *) b[n_] := b[n] = Which[n == 2, 3, n == 3, 4, EvenQ[n], 2 b[n/2], True, b[(n-1)/2+1]+b[(n-1)/2]]; a[1] = 2; a[n_] := b[n+2]-2; Table[a[n], {n, 1, 65}] (* Jean-François Alcover, Oct 05 2016 *)

Formula

a(a(n)) = 2n + 2. - Yifan Xie, Jul 14 2022
a(n+1) - a(n) is in {1, 2}. In particular, n < a(n) <= 2n. More is true: lim inf a(n)/n = 4/3 and lim sup a(n)/n = 3/2. - Charles R Greathouse IV, Dec 14 2022

A378030 Lexicographically earliest sequence of distinct positive integers such that a(a(n)) = a(a(n)-1) + a(a(n)-2).

Original entry on oeis.org

3, 4, 7, 11, 6, 17, 23, 9, 32, 12, 44, 56, 14, 70, 16, 86, 102, 19, 121, 21, 142, 24, 166, 190, 26, 216, 28, 244, 30, 274, 33, 307, 340, 35, 375, 37, 412, 39, 451, 41, 492, 43, 535, 578, 46, 624, 48, 672, 50, 722, 52, 774, 54, 828, 57, 885, 942, 59, 1001, 61, 1062, 63, 1125, 65, 1190, 67, 1257, 69, 1326, 1395, 72, 1467, 74, 1541, 76, 1617, 78, 1695, 80
Offset: 1

Views

Author

Scott R. Shannon, Nov 14 2024

Keywords

Comments

A self-referencing Fibonacci sequence. The terms appear to be concentrated along two lines, a lower straight line where a(n) is approximately n and an upper curved line where a(n) ~ n^2/4.
The missing numbers are 1, 2, 5, 8, 10, 13, 15, 18, 20, 22, 25, 27, 29, 31, ... .

Examples

			a(1) = 3 as a(3) = 7 and a(3-1) + a(3-2) = 4 + 3 = 7.
		

Crossrefs

A088720 Unique monotone sequence satisfying a(a(a(n))) = 2n.

Original entry on oeis.org

4, 5, 6, 8, 9, 10, 11, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 52, 54, 56, 58, 60, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89
Offset: 3

Views

Author

Colin Mallows, Oct 16 2003

Keywords

Comments

For k >= 1 and m >= 2, a monotone a(n) such that a^(k+1)(n) = m*n is unique only when m = 2 or (k,m) = (1,3).
Numbers k > 2 whose binary representation starts with 10 or ends with 0. - Yifan Xie, Jan 21 2025

Examples

			a(a(a(3))) = a(a(4)) = a(5) = 6.
		

Crossrefs

Programs

  • Maple
    seq(op([seq(n+2^m,n=3*2^m .. 5*2^m-1), seq(2*n-4*2^m, n=5*2^m..6*2^m-1)]), m=0..10); # Robert Israel, Apr 05 2017
  • PARI
    a(n)={my(m=logint(n/3, 2)); if(n<5*2^m, n+2^m, 2*(n-2^(m+1)))}; \\ Yifan Xie, Jan 31 2024

Formula

For a^(k+1)(n) = 2n, we have for (k+1)2^m <= n <= (2k+1)2^m, a(n) = n+2^m; for (2k+1)2^m <= n <= (2k+2)2^m, a(n) = 2n-2k*2^m.
From Robert Israel, Apr 05 2017: (Start)
a(2n) = 2*a(n).
a(4n+1) = a(2n+1) + 2*a(n).
a(4n+3) = 3*a(2n+1) - 2*a(n).
G.f. g(z) satisfies g(z) = 4*z^3 + 5*z^4 + 2*z^5 - 3*z^7 + 5*z^9 - 4*z^11 + (2+1/(2*z)+3*z/2)*g(z^2) - (1/(2*z)+3*z/2)*g(-z^2) + (2*z-2*z^3)*g(z^4).
(End)

Extensions

More terms from John W. Layman, Oct 18 2003

A088721 Unique monotone sequence satisfying a(a(a(a(n)))) = 2n.

Original entry on oeis.org

5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 36, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 68, 70, 72, 74, 76, 78, 80, 81
Offset: 4

Views

Author

Colin Mallows, Oct 12 2003

Keywords

Comments

For all k >= 0, there is a unique sequence satisfying a^(k+1)=2n. The first differences are 1^k, 2^1, 1^2k, 2^2, 1^4k, 2^4, 1^8k, ...

Crossrefs

Formula

First differences are 1^3, 2^1, 1^6, 2^2, 1^12, 2^4, 1^24, 2^8, ...

A080645 a(1) = 1; for n>1, a(n) is taken to be the smallest integer greater than a(n-1) which is consistent with the condition "for n>1, if n is a member of the sequence then a(n) is even".

Original entry on oeis.org

1, 2, 4, 6, 7, 8, 10, 12, 13, 14, 15, 16, 18, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 36, 38, 40, 42, 44, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107
Offset: 1

Views

Author

N. J. A. Sloane and Benoit Cloitre, Feb 28 2003

Keywords

References

  • Hsien-Kuei Hwang, S Janson, TH Tsai, Exact and asymptotic solutions of the recurrence f(n) = f(floor(n/2)) + f(ceiling(n/2)) + g(n): theory and applications, Preprint, 2016; http://140.109.74.92/hk/wp-content/files/2016/12/aat-hhrr-1.pdf. Also Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585

Crossrefs

Essentially the same as A007378.

Formula

a(1)=1, a(2)=2, a(3)=4; then for k>=1, abs(j)<=2^k: a(3*2^k+j)=4*2^k+3/2*j+abs(j)/2.
{a(a(n))} = {1, 2, 2i, i >= 3}.
Showing 1-10 of 11 results. Next