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 126 results. Next

A130482 a(n) = Sum_{k=0..n} (k mod 4) (Partial sums of A010873).

Original entry on oeis.org

0, 1, 3, 6, 6, 7, 9, 12, 12, 13, 15, 18, 18, 19, 21, 24, 24, 25, 27, 30, 30, 31, 33, 36, 36, 37, 39, 42, 42, 43, 45, 48, 48, 49, 51, 54, 54, 55, 57, 60, 60, 61, 63, 66, 66, 67, 69, 72, 72, 73, 75, 78, 78, 79, 81, 84, 84, 85, 87, 90, 90, 91, 93, 96, 96, 97, 99, 102, 102, 103, 105
Offset: 0

Views

Author

Hieronymus Fischer, May 29 2007

Keywords

Comments

Let A be the Hessenberg n X n matrix defined by: A[1,j]=j mod 4, A[i,i]:=1, A[i,i-1]=-1. Then, for n>=1, a(n)=det(A). - Milan Janjic, Jan 24 2010

Crossrefs

Programs

  • GAP
    a:=[0,1,3,6,6];; for n in [6..71] do a[n]:=a[n-1]+a[n-4]-a[n-5]; od; a; # G. C. Greubel, Aug 31 2019
  • Magma
    I:=[0,1,3,6,6]; [n le 5 select I[n] else Self(n-1) + Self(n-4) - Self(n-5): n in [1..71]]; // G. C. Greubel, Aug 31 2019
    
  • Maple
    a:=n->add(chrem( [n,j], [1,4] ),j=1..n):seq(a(n), n=0..70); # Zerinvary Lajos, Apr 07 2009
  • Mathematica
    Table[(6*n +(1-(-1)^n)*(1+2*I^(n+1)))/4, {n,0,70}] (* G. C. Greubel, Aug 31 2019 *)
    LinearRecurrence[{1,0,0,1,-1},{0,1,3,6,6},80] (* Harvey P. Dale, Feb 16 2024 *)
  • PARI
    a(n) = (1 - (-1)^n - (2*I)*(-I)^n + (2*I)*I^n + 6*n) / 4 \\ Colin Barker, Oct 15 2015
    
  • Sage
    def A130482_list(prec):
        P. = PowerSeriesRing(ZZ, prec)
        return P(x*(1+2*x+3*x^2)/((1-x^4)*(1-x))).list()
    A130482_list(70) # G. C. Greubel, Aug 31 2019
    

Formula

a(n) = 6*floor(n/4) + A010873(n)*(A010873(n)+1)/2.
G.f.: x*(1 + 2*x + 3*x^2)/((1-x^4)*(1-x)).
a(n) = (1 - (-1)^n - (2*i)*(-i)^n + (2*i)*i^n + 6*n) / 4 where i = sqrt(-1). - Colin Barker, Oct 15 2015
a(n) = 3*n/2 + (n mod 2)* ( (n-1) mod 4 ) - (n mod 2)/2. - Ammar Khatab, Aug 27 2020
E.g.f.: (3*x*exp(x) - 2*sin(x) + sinh(x))/2. - Stefano Spezia, Apr 22 2021
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/(4*sqrt(3)) + log(3)/4. - Amiram Eldar, Sep 17 2022

A319714 Filter sequence combining the largest proper divisor of n (A032742) with n's residue modulo 4 (A010873).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Sep 26 2018

Keywords

Comments

Restricted growth sequence transform of A286474, or equally, of A286473.

Crossrefs

Programs

  • PARI
    up_to = 100000;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A032742(n) = if(1==n,n,n/vecmin(factor(n)[,1]));
    A286474(n) = if(1==n,n,(4*A032742(n) + (n % 4)));
    v319714 = rgs_transform(vector(up_to,n,A286474(n)));
    A319714(n) = v319714[n];

A320004 Filter sequence combining the largest proper divisor of n (A032742) with n's residue modulo 4 (A010873), and a single bit (A319710) telling whether the smallest prime factor is unitary.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 04 2018

Keywords

Comments

Restricted growth sequence transform of triple [A010873(A020639(n)), A032742(n), A319710(n)], or equally, of ordered pair [A319714(n), A319710(n)].
Here any nontrivial equivalence classes (that is, when we exclude the singleton classes and two infinite classes of A002144 and A002145), like the example shown, may not contain any even numbers, nor any numbers from A283050. See additional comments in A319717 and A319994.
For all i, j:
a(i) = a(j) => A024362(i) = A024362(j),
a(i) = a(j) => A067029(i) = A067029(j),
a(i) = a(j) => A071178(i) = A071178(j),
a(i) = a(j) => A077462(i) = A077462(j) => A101296(i) = A101296(j).

Examples

			For n = 33 (3*11) and n = 77 (7*11), the modulo 4 residue of the smallest prime factor is 3, and the largest proper divisors (A032742) is also equal 11, and the smallest prime factor is unitary. Thus a(33) = a(77) (= 25, a running count value allotted by rgs-transform).
		

Crossrefs

Cf. also A319717 (analogous sequence for modulo 6 residues).
Cf. A002145 (positions of 3's), A002144 (positions of 5's).
Differs from A319704 for the first time at n=77, and from A319714 for the first time at n=49.

Programs

  • PARI
    up_to = 100000;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A032742(n) = if(1==n,n,n/vecmin(factor(n)[,1]));
    A286474(n) = if(1==n,n,(4*A032742(n) + (n % 4)));
    A319710(n) = ((n>1)&&(factor(n)[1,2]>1));
    v320004 = rgs_transform(vector(up_to,n,[A286474(n),A319710(n)]));
    A320004(n) = v320004[n];

A004526 Nonnegative integers repeated, floor(n/2).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Number of elements in the set {k: 1 <= 2k <= n}.
Dimension of the space of weight 2n+4 cusp forms for Gamma_0(2).
Dimension of the space of weight 1 modular forms for Gamma_1(n+1).
Number of ways 2^n is expressible as r^2 - s^2 with s > 0. Proof: (r+s) and (r-s) both should be powers of 2, even and distinct hence a(2k) = a(2k-1) = (k-1) etc. - Amarnath Murthy, Sep 20 2002
Lengths of sides of Ulam square spiral; i.e., lengths of runs of equal terms in A063826. - Donald S. McDonald, Jan 09 2003
Number of partitions of n into two parts. A008619 gives partitions of n into at most two parts, so A008619(n) = a(n) + 1 for all n >= 0. Partial sums are A002620 (Quarter-squares). - Rick L. Shepherd, Feb 27 2004
a(n+1) is the number of 1's in the binary expansion of the Jacobsthal number A001045(n). - Paul Barry, Jan 13 2005
Number of partitions of n+1 into two distinct (nonzero) parts. Example: a(8) = 4 because we have [8,1],[7,2],[6,3] and [5,4]. - Emeric Deutsch, Apr 14 2006
Complement of A000035, since A000035(n)+2*a(n) = n. Also equal to the partial sums of A000035. - Hieronymus Fischer, Jun 01 2007
Number of binary bracelets of n beads, two of them 0. For n >= 2, a(n-2) is the number of binary bracelets of n beads, two of them 0, with 00 prohibited. - Washington Bomfim, Aug 27 2008
Let A be the Hessenberg n X n matrix defined by: A[1,j] = j mod 2, A[i,i]:=1, A[i,i-1] = -1, and A[i,j] = 0 otherwise. Then, for n >= 1, a(n+1) = (-1)^n det(A). - Milan Janjic, Jan 24 2010
From Clark Kimberling, Mar 10 2011: (Start)
Let RT abbreviate rank transform (A187224). Then
RT(this sequence) = A187484;
RT(this sequence without 1st term) = A026371;
RT(this sequence without 1st 2 terms) = A026367;
RT(this sequence without 1st 3 terms) = A026363. (End)
The diameter (longest path) of the n-cycle. - Cade Herron, Apr 14 2011
For n >= 3, a(n-1) is the number of two-color bracelets of n beads, three of them are black, having a diameter of symmetry. - Vladimir Shevelev, May 03 2011
Pelesko (2004) refers erroneously to this sequence instead of A008619. - M. F. Hasler, Jul 19 2012
Number of degree 2 irreducible characters of the dihedral group of order 2(n+1). - Eric M. Schmidt, Feb 12 2013
For n >= 3 the sequence a(n-1) is the number of non-congruent regions with infinite area in the exterior of a regular n-gon with all diagonals drawn. See A217748. - Martin Renner, Mar 23 2013
a(n) is the number of partitions of 2n into exactly 2 even parts. a(n+1) is the number of partitions of 2n into exactly 2 odd parts. This just rephrases the comment of E. Deutsch above. - Wesley Ivan Hurt, Jun 08 2013
Number of the distinct rectangles and square in a regular n-gon is a(n/2) for even n and n >= 4. For odd n, such number is zero, see illustration in link. - Kival Ngaokrajang, Jun 25 2013
x-coordinate from the image of the point (0,-1) after n reflections across the lines y = n and y = x respectively (alternating so that one reflection is applied on each step): (0,-1) -> (0,1) -> (1,0) -> (1,2) -> (2,1) -> (2,3) -> ... . - Wesley Ivan Hurt, Jul 12 2013
a(n) is the number of partitions of 2n into exactly two distinct odd parts. a(n-1) is the number of partitions of 2n into exactly two distinct even parts, n > 0. - Wesley Ivan Hurt, Jul 21 2013
a(n) is the number of permutations of length n avoiding 213, 231 and 312, or avoiding 213, 312 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
Also a(n) is the number of different patterns of 2-color, 2-partition of n. - Ctibor O. Zizka, Nov 19 2014
Minimum in- and out-degree for a directed K_n (see link). - Jon Perry, Nov 22 2014
a(n) is also the independence number of the triangular graph T(n). - Luis Manuel Rivera Martínez, Mar 12 2015
For n >= 3, a(n+4) is the least positive integer m such that every m-element subset of {1,2,...,n} contains distinct i, j, k with i + j = k (equivalently, with i - j = k). - Rick L. Shepherd, Jan 24 2016
More generally, the ordinary generating function for the integers repeated k times is x^k/((1 - x)(1 - x^k)). - Ilya Gutkovskiy, Mar 21 2016
a(n) is the number of numbers of the form F(i)*F(j) between F(n+3) and F(n+4), where 2 < i < j and F = A000045 (Fibonacci numbers). - Clark Kimberling, May 02 2016
The arithmetic function v_2(n,2) as defined in A289187. - Robert Price, Aug 22 2017
a(n) is also the total domination number of the (n-3)-gear graph. - Eric W. Weisstein, Apr 07 2018
Consider the numbers 1, 2, ..., n; a(n) is the largest integer t such that these numbers can be arranged in a row so that all consecutive terms differ by at least t. Example: a(6) = a(7) = 3, because of respectively (4, 1, 5, 2, 6, 3) and (1, 5, 2, 6, 3, 7, 4) (see link BMO - Problem 2). - Bernard Schott, Mar 07 2020
a(n-1) is also the number of integer-sided triangles whose sides a < b < c are in arithmetic progression with a middle side b = n (see A307136). Example, for b = 4, there exists a(3) = 1 such triangle corresponding to Pythagorean triple (3, 4, 5). For the triples, miscellaneous properties and references, see A336750. - Bernard Schott, Oct 15 2020
For n >= 1, a(n-1) is the greatest remainder on division of n by any k in 1..n. - David James Sycamore, Sep 05 2021
Number of incongruent right triangles that can be formed from the vertices of a regular n-gon is given by a(n/2) for n even. For n odd such number is zero. For a regular n-gon, the number of incongruent triangles formed from its vertices is given by A069905(n). The number of incongruent acute triangles is given by A005044(n). The number of incongruent obtuse triangles is given by A008642(n-4) for n > 3 otherwise 0, with offset 0. - Frank M Jackson, Nov 26 2022
The inverse binomial transform is 0, 0, 1, -2, 4, -8, 16, -32, ... (see A122803). - R. J. Mathar, Feb 25 2023

Examples

			G.f. = x^2 + x^3 + 2*x^4 + 2*x^5 + 3*x^6 + 3*x^7 + 4*x^8 + 4*x^9 + 5*x^10 + ...
		

References

  • G. L. Alexanderson et al., The William Powell Putnam Mathematical Competition - Problems and Solutions: 1965-1984, M.A.A., 1985; see Problem A-1 of 27th Competition.
  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 120, P(n,2).
  • Graham, Knuth and Patashnik, Concrete Mathematics, Addison-Wesley, NY, 1989, page 77 (partitions of n into at most 2 parts).

Crossrefs

a(n+2) = A008619(n). See A008619 for more references.
A001477(n) = a(n+1)+a(n). A000035(n) = a(n+1)-A002456(n).
a(n) = A008284(n, 2), n >= 1.
Zero followed by the partial sums of A000035.
Column 2 of triangle A094953. Second row of A180969.
Partial sums: A002620. Other related sequences: A010872, A010873, A010874.
Cf. similar sequences of the integers repeated k times: A001477 (k = 1), this sequence (k = 2), A002264 (k = 3), A002265 (k = 4), A002266 (k = 5), A152467 (k = 6), A132270 (k = 7), A132292 (k = 8), A059995 (k = 10).
Cf. A289187, A139756 (binomial transf).

Programs

  • Haskell
    a004526 = (`div` 2)
    a004526_list = concatMap (\x -> [x, x]) [0..]
    -- Reinhard Zumkeller, Jul 27 2012
    
  • Magma
    [Floor(n/2): n in [0..100]]; // Vincenzo Librandi, Nov 19 2014
    
  • Maple
    A004526 := n->floor(n/2); seq(floor(i/2),i=0..50);
  • Mathematica
    Table[(2n - 1)/4 + (-1)^n/4, {n, 0, 70}] (* Stefan Steinerberger, Apr 02 2006 *)
    f[n_] := If[OddQ[n], (n - 1)/2, n/2]; Array[f, 74, 0] (* Robert G. Wilson v, Apr 20 2012 *)
    With[{c=Range[0,40]},Riffle[c,c]] (* Harvey P. Dale, Aug 26 2013 *)
    CoefficientList[Series[x^2/(1 - x - x^2 + x^3), {x, 0, 75}], x] (* Robert G. Wilson v, Feb 05 2015 *)
    LinearRecurrence[{1, 1, -1}, {0, 0, 1}, 75] (* Robert G. Wilson v, Feb 05 2015 *)
    Floor[Range[0, 40]/2] (* Eric W. Weisstein, Apr 07 2018 *)
  • Maxima
    makelist(floor(n/2),n,0,50); /* Martin Ettl, Oct 17 2012 */
    
  • PARI
    a(n)=n\2 /* Jaume Oliver Lafont, Mar 25 2009 */
    
  • PARI
    x='x+O('x^100); concat([0, 0], Vec(x^2/((1+x)*(x-1)^2))) \\ Altug Alkan, Mar 21 2016
    
  • Python
    def a(n): return n//2
    print([a(n) for n in range(74)]) # Michael S. Branicky, Apr 30 2022
  • Sage
    def a(n) : return( dimension_cusp_forms( Gamma0(2), 2*n+4) ); # Michael Somos, Jul 03 2014
    
  • Sage
    def a(n) : return( dimension_modular_forms( Gamma1(n+1), 1) ); # Michael Somos, Jul 03 2014
    

Formula

G.f.: x^2/((1+x)*(x-1)^2).
a(n) = floor(n/2).
a(n) = ceiling((n+1)/2). - Eric W. Weisstein, Jan 11 2024
a(n) = 1 + a(n-2).
a(n) = a(n-1) + a(n-2) - a(n-3).
a(2*n) = a(2*n+1) = n.
a(n+1) = n - a(n). - Henry Bottomley, Jul 25 2001
For n > 0, a(n) = Sum_{i=1..n} (1/2)/cos(Pi*(2*i-(1-(-1)^n)/2)/(2*n+1)). - Benoit Cloitre, Oct 11 2002
a(n) = (2*n-1)/4 + (-1)^n/4; a(n+1) = Sum_{k=0..n} k*(-1)^(n+k). - Paul Barry, May 20 2003
E.g.f.: ((2*x-1)*exp(x) + exp(-x))/4. - Paul Barry, Sep 03 2003
G.f.: (1/(1-x)) * Sum_{k >= 0} t^2/(1-t^4) where t = x^2^k. - Ralf Stephan, Feb 24 2004
a(n+1) = A000120(A001045(n)). - Paul Barry, Jan 13 2005
a(n) = (n-(1-(-1)^n)/2)/2 = (1/2)*(n-|sin(n*Pi/2)|). Likewise: a(n) = (n-A000035(n))/2. Also: a(n) = Sum_{k=0..n} A000035(k). - Hieronymus Fischer, Jun 01 2007
The expression floor((x^2-1)/(2*x)) (x >= 1) produces this sequence. - Mohammad K. Azarian, Nov 08 2007; corrected by M. F. Hasler, Nov 17 2008
a(n+1) = A002378(n) - A035608(n). - Reinhard Zumkeller, Jan 27 2010
a(n+1) = A002620(n+1) - A002620(n) = floor((n+1)/2)*ceiling((n+1)/2) - floor(n^2/4). - Jonathan Vos Post, May 20 2010
For n >= 2, a(n) = floor(log_2(2^a(n-1) + 2^a(n-2))). - Vladimir Shevelev, Jun 22 2010
a(n) = A180969(2,n). - Adriano Caroli, Nov 24 2010
A001057(n-1) = (-1)^n*a(n), n > 0. - M. F. Hasler, Jul 19 2012
a(n) = A008615(n) + A002264(n). - Reinhard Zumkeller, Apr 28 2014
Euler transform of length 2 sequence [1, 1]. - Michael Somos, Jul 03 2014

Extensions

Partially edited by Joerg Arndt, Mar 11 2010, and M. F. Hasler, Jul 19 2012

A010888 Digital root of n (repeatedly add the digits of n until a single digit is reached).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5
Offset: 0

Views

Author

Keywords

Comments

This is sometimes also called the additive digital root of n.
n mod 9 (A010878) is a very similar sequence.
Partial sums are given by A130487(n-1) + n (for n > 0). - Hieronymus Fischer, Jun 08 2007
Decimal expansion of 13717421/111111111 is 0.123456789123456789123456789... with period 9. - Eric Desbiaux, May 19 2008
Decimal expansion of 13717421 / 1111111110 = 0.0[123456789] (periodic) - Daniel Forgues, Feb 27 2017
a(A005117(n)) < 9. - Reinhard Zumkeller, Mar 30 2010
My friend Jahangeer Kholdi has found that 19 is the smallest prime p such that for each number n, a(p*n) = a(n). In fact we have: a(m*n) = a(a(m)*a(n)) so all numbers with digital root 1 (numbers of the form 9k + 1) have this property. See comment lines of A017173. Also we have a(m+n) = a(a(m) + a(n)). - Farideh Firoozbakht, Jul 23 2010

Examples

			The digits of 37 are 3 and 7, and 3 + 7 = 10. And the digits of 10 are 1 and 0, and 1 + 0 = 1, so a(37) = 1.
		

References

  • Martin Gardner, Mathematics, Magic and Mystery, 1956.

Crossrefs

Cf. A007953, A007954, A031347, A113217, A113218, A010878 (n mod 9), A010872, A010873, A010874, A010875, A010876, A010877, A010879, A004526, A002264, A002265, A002266, A017173, A031286 (additive persistence of n), (multiplicative digital root of n), A031346 (multiplicative persistence of n).

Programs

Formula

If n = 0 then a(n) = 0; otherwise a(n) = (n reduced mod 9), but if the answer is 0 change it to 9.
Equivalently, if n = 0 then a(n) = 0, otherwise a(n) = (n - 1 reduced mod 9) + 1.
If the initial 0 term is ignored, the sequence is periodic with period 9.
From Hieronymus Fischer, Jun 08 2007: (Start)
a(n) = A010878(n-1) + 1 (for n > 0).
G.f.: g(x) = x*(Sum_{k = 0..8}(k+1)*x^k)/(1 - x^9). Also: g(x) = x(9x^10 - 10x^9 + 1)/((1 - x^9)(1 - x)^2). (End)
a(n) = n - 9*floor((n-1)/9), for n > 0. - José de Jesús Camacho Medina, Nov 10 2014

A002264 Nonnegative integers repeated 3 times.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25
Offset: 0

Views

Author

Keywords

Comments

Complement of A010872, since A010872(n) + 3*a(n) = n. - Hieronymus Fischer, Jun 01 2007
Chvátal proved that, given an arbitrary n-gon, there exist a(n) points such that all points in the interior are visible from at least one of those points; further, for all n >= 3, there exists an n-gon which cannot be covered in this fashion with fewer than a(n) points. This is known as the "art gallery problem". - Charles R Greathouse IV, Aug 29 2012
The inverse binomial transform is 0, 0, 0, 1, -3, 6, -9, 9, 0, -27, 81, -162, 243, -243, 0, 729,.. (see A000748). - R. J. Mathar, Feb 25 2023

Crossrefs

Partial sums give A130518.
Cf. A004523 interlaced with A004396.
Apart from the zeros, this is column 3 of A235791.

Programs

  • Haskell
    a002264 n = a002264_list !! n
    a002264_list = 0 : 0 : 0 : map (+ 1) a002264_list
    -- Reinhard Zumkeller, Nov 06 2012, Apr 16 2012
    
  • Magma
    [Floor(n/3): n in [0..100]]; // Vincenzo Librandi, Apr 29 2015
    
  • Magma
    &cat [[n,n,n]: n in [0..30]]; // Bruno Berselli, Apr 29 2015
  • Maple
    seq(i$3,i=0..100); # Robert Israel, Aug 04 2014
  • Mathematica
    Flatten[Table[{n, n, n}, {n, 0, 25}]] (* Harvey P. Dale, Jun 09 2013 *)
    Floor[Range[0, 20]/3] (* Eric W. Weisstein, Aug 12 2023 *)
    Table[Floor[n/3], {n, 0, 20}] (* Eric W. Weisstein, Aug 12 2023 *)
    Table[(n - Cos[2 (n - 2) Pi/3] + Sin[2 (n - 2) Pi/3]/Sqrt[3] - 1)/3, {n, 0, 20}] (* Eric W. Weisstein, Aug 12 2023 *)
    Table[(n - ChebyshevU[n - 2, -1/2] - 1)/3, {n, 0, 20}] (* Eric W. Weisstein, Aug 12 2023 *)
    LinearRecurrence[{1, 0, 1, -1}, {0, 0, 0, 1}, 20] (* Eric W. Weisstein, Aug 12 2023 *)
    CoefficientList[Series[x^3/((-1 + x)^2 (1 + x + x^2)), {x, 0, 20}], x] (* Eric W. Weisstein, Aug 12 2023 *)
  • PARI
    a(n)=n\3  /* Jaume Oliver Lafont, Mar 25 2009 */
    
  • PARI
    v=[0,0];for(n=2,50,v=concat(v,n-2-v[#v]-v[#v-1]));v \\ Derek Orr, Apr 28 2015
    
  • Sage
    [floor(n/3) for n in range(0,79)] # Zerinvary Lajos, Dec 01 2009
    

Formula

a(n) = floor(n/3).
a(n) = (3*n-3-sqrt(3)*(1-2*cos(2*Pi*(n-1)/3))*sin(2*Pi*(n-1)/3))/9. - Hieronymus Fischer, Sep 18 2007
a(n) = (n - A010872(n))/3. - Hieronymus Fischer, Sep 18 2007
Complex representation: a(n) = (n - (1 - r^n)*(1 + r^n/(1 - r)))/3 where r = exp(2*Pi/3*i) = (-1 + sqrt(3)*i)/2 and i = sqrt(-1). - Hieronymus Fischer, Sep 18 2007; - corrected by Guenther Schrack, Sep 26 2019
a(n) = Sum_{k=0..n-1} A022003(k). - Hieronymus Fischer, Sep 18 2007
G.f.: x^3/((1-x)*(1-x^3)). - Hieronymus Fischer, Sep 18 2007
a(n) = (n - 1 + 2*sin(4*(n+2)*Pi/3)/sqrt(3))/3. - Jaume Oliver Lafont, Dec 05 2008
For n >= 3, a(n) = floor(log_3(3^a(n-1) + 3^a(n-2) + 3^a(n-3))). - Vladimir Shevelev, Jun 22 2010
a(n) = (n - 3 + A010872(n-1) + A010872(n-2))/3 using Zumkeller's 2008 formula in A010872. - Adriano Caroli, Nov 23 2010
a(n) = A004526(n) - A008615(n). - Reinhard Zumkeller, Apr 28 2014
a(2*n) = A004523(n) and a(2*n+1) = A004396(n). - L. Edson Jeffery, Jul 30 2014
a(n) = n - 2 - a(n-1) - a(n-2) for n > 1 with a(0) = a(1) = 0. - Derek Orr, Apr 28 2015
From Wesley Ivan Hurt, May 27 2015: (Start)
a(n) = a(n-1) + a(n-3) - a(n-4), n > 4.
a(n) = (n - 1 + 0^((-1)^(n/3) - (-1)^n) - 0^((-1)^(n/3)*(-1)^(1/3) + (-1)^n))/3. (End)
a(n) = (3*n - 3 + r^n*(1 - r) + r^(2*n)*(r + 2))/9 where r = (-1 + sqrt(-3))/2. - Guenther Schrack, Sep 26 2019
E.g.f.: exp(x)*(x - 1)/3 + exp(-x/2)*(3*cos(sqrt(3)*x/2) + sqrt(3)*sin(sqrt(3)*x/2))/9. - Stefano Spezia, Oct 17 2022

A010872 a(n) = n mod 3.

Original entry on oeis.org

0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2
Offset: 0

Views

Author

Keywords

Comments

Fixed point of morphism 0 -> 01, 1 -> 20, 2 -> 12.
Complement of A002264, since 3*A002264(n) + a(n) = n. - Hieronymus Fischer, Jun 01 2007
Decimal expansion of 4/333. - Elmo R. Oliveira, Feb 19 2024
Period 3: repeat [0, 1, 2]. - Elmo R. Oliveira, Jun 20 2024

Examples

			G.f. = x + 2*x^2 + x^4 + 2*x^5 + x^7 + 2*x^8 + x^10 + 2*x^11 + x^13 + ...
		

Crossrefs

Cf. A010882, A130481 (partial sums), A131555.
Other related sequences are A130482, A130483, A130484, A130485.

Programs

  • Haskell
    a010872 = (`mod` 3)
    a010872_list = cycle [0,1,2]  -- Reinhard Zumkeller, May 26 2012
    
  • Magma
    [n mod 3 : n in [0..100]]; // Wesley Ivan Hurt, May 27 2015
    
  • Maple
    A010872:=n->(n mod 3): seq(A010872(n), n=0..100); # Wesley Ivan Hurt, May 27 2015
  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 1}, 1 -> {2, 0}, 2 -> {1, 2}})]}], {0}, 7] (* Robert G. Wilson v, Feb 28 2005 *)
    PadRight[{},120,{0,1,2}] (* or *) Mod[Range[0,120],3] (* Harvey P. Dale, Jul 20 2025 *)
  • PARI
    my(x='x+O('x^200)); concat(0, Vec((2*x^2+x)/(1-x^3))) \\ Altug Alkan, Mar 23 2016

Formula

a(n) = n - 3*floor(n/3) = a(n-3).
G.f.: (2*x^2+x)/(1-x^3). - Mario Catalani (mario.catalani(AT)unito.it), Jan 08 2003
From Hieronymus Fischer, May 29 2007: (Start)
a(n) = 1 + (1-2*cos(2*Pi*(n-1)/3)) * sin(2*Pi*(n-1)/3) / sqrt(3).
a(n) = (1-r^n)*(1+r^n/(1-r)) where r=exp(2*Pi*i/3)=(-1+sqrt(3)*i)/2 and i=sqrt(-1). [corrected by Guenther Schrack, Sep 23 2019] (End)
From Hieronymus Fischer, Jun 01 2007: (Start)
a(n) = (16/9)*((sin(Pi*(n-2)/3))^2+2*(sin(Pi*(n-1)/3))^2)*(sin(Pi*n/3))^2.
a(n) = (4/3)*(|sin(Pi*(n-2)/3)|+2*|sin(Pi*(n-1)/3)|)*|sin(Pi*n/3)|.
a(n) = (4/9)*((1-cos(2*Pi*(n-2)/3))+2*(1-cos(2*Pi*(n-1)/3)))*(1-cos(2*Pi*n/3)). (End)
a(n) = 3 - a(n-1) - a(n-2) for n > 1. - Reinhard Zumkeller, Apr 13 2008
a(n) = 1-2*sin(4*Pi*(n+2)/3)/sqrt(3). - Jaume Oliver Lafont, Dec 05 2008
From Wesley Ivan Hurt, May 27 2015, Mar 22 2016: (Start)
a(n) = 1 - 0^((-1)^(n/3)-(-1)^n) + 0^((-1)^((n+1)/3)+(-1)^n).
a(n) = 1 + (-1)^((2*n+4)/3)/3 + (-1)^((-2*n-4)/3)/3 + 2*(-1)^((2*n+2)/3)/3 + 2*(-1)^((-2*n-2)/3)/3.
a(n) = 1 + 2*cos(Pi*(2*n+4)/3)/3 + 4*cos(Pi*(2*n+2)/3)/3. (End)
a(n) = (r^n*(r-1) - r^(2*n)*(r + 2) + 3)/3 where r = (-1 + sqrt(-3))/2. - Guenther Schrack, Sep 23 2019
E.g.f.: exp(x) - exp(-x/2)*(cos(sqrt(3)*x/2) + sin(sqrt(3)*x/2)/sqrt(3)). - Stefano Spezia, Mar 01 2020
a(n) = A010882(n) - 1 = A131555(2*n) = A131555(2*n+1). - Elmo R. Oliveira, Jun 25 2024
From Nicolas Bělohoubek, May 26 2025: (Start)
a(n) = (3*a(n-1)+1)*(2-a(n-1))/2 for n > 0.
a(n) = (2*a(n-1)-4)/(3*a(n-1)-4) for n > 0. (End)

Extensions

Edited by Joerg Arndt, Apr 21 2014

A002265 Nonnegative integers repeated 4 times.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19
Offset: 0

Views

Author

Keywords

Comments

For n>=1 and i=sqrt(-1) let F(n) the n X n matrix of the Discrete Fourier Transform (DFT) whose element (j,k) equals exp(-2*Pi*i*(j-1)*(k-1)/n)/sqrt(n). The multiplicities of the four eigenvalues 1, i, -1, -i of F(n) are a(n+4), a(n-1), a(n+2), a(n+1), hence a(n+4) + a(n-1) + a(n+2) + a(n+1) = n for n>=1. E.g., the multiplicities of the eigenvalues 1, i, -1, -i of the DFT-matrix F(4) are a(8)=2, a(3)=0, a(6)=1, a(5)=1, summing up to 4. - Franz Vrabec, Jan 21 2005
Complement of A010873, since A010873(n)+4*a(n)=n. - Hieronymus Fischer, Jun 01 2007
For even values of n, a(n) gives the number of partitions of n into exactly two parts with both parts even. - Wesley Ivan Hurt, Feb 06 2013
a(n-4) counts number of partitions of (n) into parts 1 and 4. For example a(11) = 3 with partitions (44111), (41111111), (11111111111). - David Neil McGrath, Dec 04 2014
a(n-4) counts walks (closed) on the graph G(1-vertex; 1-loop, 4-loop) where order of loops is unimportant. - David Neil McGrath, Dec 04 2014
Number of partitions of n into 4 parts whose smallest 3 parts are equal. - Wesley Ivan Hurt, Jan 17 2021

References

  • V. Cizek, Discrete Fourier Transforms and their Applications, Adam Hilger, Bristol 1986, p. 61.

Crossrefs

Zero followed by partial sums of A011765.
Partial sums: A130519. Other related sequences: A004526, A010872, A010873, A010874.
Third row of A180969.

Programs

Formula

a(n) = floor(n/4), n>=0;
G.f.: (x^4)/((1-x)*(1-x^4)).
a(n) = (2*n-(3-(-1)^n-2*(-1)^floor(n/2)))/8; also a(n) = (2*n-(3-(-1)^n-2*sin(Pi/4*(2*n+1+(-1)^n))))/8 = (n-A010873(n))/4. - Hieronymus Fischer, May 29 2007
a(n) = (1/4)*(n-(3-(-1)^n-2*(-1)^((2*n-1+(-1)^n)/4))/2). - Hieronymus Fischer, Jul 04 2007
a(n) = floor((n^4-1)/4*n^3) (n>=1); a(n) = floor((n^4-n^3)/(4*n^3-3*n^2)) (n>=1). - Mohammad K. Azarian, Nov 08 2007 and Aug 01 2009
For n>=4, a(n) = floor( log_4( 4^a(n-1) + 4^a(n-2) + 4^a(n-3) + 4^a(n-4) ) ). - Vladimir Shevelev, Jun 22 2010
a(n) = A180969(2,n). - Adriano Caroli, Nov 26 2010
a(n) = A173562(n)-A000290(n); a(n+2) = A035608(n)-A173562(n). - Reinhard Zumkeller, Feb 21 2010
a(n+1) = A140201(n) - A057353(n+1). - Reinhard Zumkeller, Feb 26 2011
a(n) = ceiling((n-3)/4), n >= 0. - Wesley Ivan Hurt, Jun 01 2013
a(n) = (2*n + (-1)^n + 2*sin(Pi*n/2) + 2*cos(Pi*n/2) - 3)/8. - Todd Silvestri, Oct 27 2014
E.g.f.: (x/4 - 3/8)*exp(x) + exp(-x)/8 + (sin(x)+cos(x))/4. - Robert Israel, Oct 30 2014
a(n) = a(n-1) + a(n-4) - a(n-5) with initial values a(3)=0, a(4)=1, a(5)=1, a(6)=1, a(7)=1. - David Neil McGrath, Dec 04 2014
a(n) = A004526(A004526(n)). - Bruno Berselli, Jul 01 2016
From Guenther Schrack, May 03 2019: (Start)
a(n) = (2*n - 3 + (-1)^n + 2*(-1)^(n*(n-1)/2))/8.
a(n) = a(n-4) + 1, a(k)=0 for k=0,1,2,3, for n > 3. (End)

A263273 Bijective base-3 reverse: a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Comments

Here the base-3 reverse has been adjusted so that the maximal suffix of trailing zeros (in base-3 representation A007089) stays where it is at the right side, and only the section from the most significant digit to the least significant nonzero digit is reversed, thus making this sequence a self-inverse permutation of nonnegative integers.
Because successive powers of 3 and 9 modulo 2, 4 and 8 are always either constant 1, 1, 1, ... or alternating 1, -1, 1, -1, ... it implies similar simple divisibility rules for 2, 4 and 8 in base 3 as e.g. 3, 9 and 11 have in decimal base (see the Wikipedia-link). As these rules do not depend on which direction they are applied from, it means that this bijection preserves the fact whether a number is divisible by 2, 4 or 8, or whether it is not. Thus natural numbers are divided to several subsets, each of which is closed with respect to this bijection. See the Crossrefs section for permutations obtained from these sections.
When polynomials over GF(3) are encoded as natural numbers (coefficients presented with the digits of the base-3 expansion of n), this bijection works as a multiplicative automorphism of the ring GF(3)[X]. This follows from the fact that as there are no carries involved, the multiplication (and thus also the division) of such polynomials could be as well performed by temporarily reversing all factors (like they were seen through mirror). This implies also that the sequences A207669 and A207670 are closed with respect to this bijection.

Examples

			For n = 15, A007089(15) = 120. Reversing this so that the trailing zero stays at the right yields 210 = A007089(21), thus a(15) = 21 and vice versa, a(21) = 15.
		

Crossrefs

Bisections: A264983, A264984.
Permutations induced by various sections: A263272 (a(2n)/2), A264974 (a(4n)/4), A264978 (a(8n)/8), A264985, A264989.
Cf. also A004488, A140263, A140264, A246207, A246208 (other base-3 related permutations).

Programs

  • Mathematica
    r[n_] := FromDigits[Reverse[IntegerDigits[n, 3]], 3]; b[n_] := n/ 3^IntegerExponent[n, 3]; c[n_] := n/b[n]; a[0]=0; a[n_] := r[b[n]]*c[n]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Dec 29 2015 *)
  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a(n): return 0 if n==0 else a030102(a038502(n))*a038500(n) # Indranil Ghosh, May 22 2017
  • Scheme
    (define (A263273 n) (if (zero? n) n (* (A030102 (A038502 n)) (A038500 n))))
    

Formula

a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
A010873(a(n)) = 0 if and only if A010873(n) = 0. [See the comments section.]

A121262 The characteristic function of the multiples of four.

Original entry on oeis.org

1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0
Offset: 0

Views

Author

Paolo P. Lava and Giorgio Balzarotti, Aug 23 2006, Aug 30 2007

Keywords

Comments

Period 4: repeat [1, 0, 0, 0].
a(n) is also the number of partitions of n where each part is four (Since the empty partition has no parts, a(0) = 1). Hence a(n) is also the number of 2-regular graphs on n vertices such that each component has girth exactly four. - Jason Kimberley, Oct 01 2011
This sequence is the Euler transformation of A185014. - Jason Kimberley, Oct 01 2011
Number of permutations satisfying -k <= p(i) - i <= r and p(i)-i not in I, i = 1..n, with k = 1, r = 3, I = {0, 1, 2}. - Vladimir Baltic, Mar 07 2012

References

  • G. Balzarotti and P. P. Lava, Le sequenze di numeri interi, Hoepli, 2008, p. 82.

Crossrefs

A011765 is another version of the same sequence.
Characteristic function of multiples of g: A000007 (g=0), A000012 (g=1), A059841 (g=2), A079978 (g=3), this sequence (g=4), A079998 (g=5), A079979 (g=6), A082784 (g=7). - Jason Kimberley, Oct 14 2011

Programs

Formula

a(n) = (1/4)*(2*cos(n*Pi/2) + 1 + (-1)^n).
Additive with a(p^e) = 1 if p = 2 and e > 1, 0 otherwise.
Sequence shifted right by 2 is additive with a(p^e) = 1 if p = 2 and e = 1, 0 otherwise.
a(n) = 1 - (C(n + 1, n + (-1)^(n+1)) mod 2).
a(n) = 0^(n mod 4). - Reinhard Zumkeller, Sep 30 2008
a(n) = !(n%4). - Jaume Oliver Lafont, Mar 01 2009
a(n) = (1/4)*(1 + I^n + (-1)^n + (-I)^n). - Paolo P. Lava, May 04 2010
a(n) = ((n-1)^k mod 4 - (n-1)^(k-1) mod 4)/2, k > 2. - Gary Detlefs, Feb 21 2011
a(n) = floor(1/2*cos(n*Pi/2) + 1/2). - Gary Detlefs, May 16 2011
G.f.: 1/(1 - x^4); a(n) = (1 + (-1)^n)*(1 + i^((n-1)*n))/4, where i = sqrt(-1). - Bruno Berselli, Sep 28 2011
a(n) = floor(((n+3) mod 4)/3). - Gary Detlefs, Dec 29 2011
a(n) = floor(n/4) - floor((n-1)/4). - Tani Akinari, Oct 25 2012
a(n) = ceiling( (1/2)*cos(Pi*n/2) ). - Wesley Ivan Hurt, May 31 2013
a(n) = ((1+(-1)^(n/2))*(1+(-1)^n))/4. - Bogart B. Strauss, Jul 14 2013
a(n) = C(n-1,3) mod 2. - Wesley Ivan Hurt, Oct 07 2014
a(n) = (((n+1) mod 4) mod 3) mod 2. - Ctibor O. Zizka, Dec 11 2014
a(n) = (sin(Pi*(n+1)/2)^2)/2 + sin(Pi*(n+1)/2)/2. - Mikael Aaltonen, Jan 02 2015
E.g.f.: (cos(x) + cosh(x))/2. - Vaclav Kotesovec, Feb 15 2015
a(n) = a(n-4) for n>3. - Wesley Ivan Hurt, Jul 07 2016
a(n) = (1-sqrt(2)*cos(n*Pi/2-3*Pi/4))/2 * cos(n*Pi/2). - (found by Steve Chow) Iain Fox, Nov 16 2017
a(n) = 1-A166486(n). - Antti Karttunen, Jul 29 2018
a(n) = (1-(-1)^A142150(n+1))/2. - Adriano Caroli, Sep 28 2019

Extensions

More terms from Antti Karttunen, Jul 29 2018
Showing 1-10 of 126 results. Next