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

A047999 Sierpiński's [Sierpinski's] triangle (or gasket): triangle, read by rows, formed by reading Pascal's triangle (A007318) mod 2.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Restored the alternative spelling of Sierpinski to facilitate searching for this triangle using regular-expression matching commands in ASCII. - N. J. A. Sloane, Jan 18 2016
Also triangle giving successive states of cellular automaton generated by "Rule 60" and "Rule 102". - Hans Havermann, May 26 2002
Also triangle formed by reading triangle of Eulerian numbers (A008292) mod 2. - Philippe Deléham, Oct 02 2003
Self-inverse when regarded as an infinite lower triangular matrix over GF(2).
Start with [1], repeatedly apply the map 0 -> [00/00], 1 -> [10/11] [Allouche and Berthe]
Also triangle formed by reading triangles A011117, A028338, A039757, A059438, A085881, A086646, A086872, A087903, A104219 mod 2. - Philippe Deléham, Jun 18 2005
J. H. Conway writes (in Math Forum): at least the first 31 rows give odd-sided constructible polygons (sides 1, 3, 5, 15, 17, ... see A001317). The 1's form a Sierpiński sieve. - M. Dauchez (mdzzdm(AT)yahoo.fr), Sep 19 2005
When regarded as an infinite lower triangular matrix, its inverse is a (-1,0,1)-matrix with zeros undisturbed and the nonzero entries in every column form the Prouhet-Thue-Morse sequence (1,-1,-1,1,-1,1,1,-1,...) A010060 (up to relabeling). - David Callan, Oct 27 2006
Triangle read by rows: antidiagonals of an array formed by successive iterates of running sums mod 2, beginning with (1, 1, 1, ...). - Gary W. Adamson, Jul 10 2008
T(n,k) = A057427(A143333(n,k)). - Reinhard Zumkeller, Oct 24 2010
The triangle sums, see A180662 for their definitions, link Sierpiński’s triangle A047999 with seven sequences, see the crossrefs. The Kn1y(n) and Kn2y(n), y >= 1, triangle sums lead to the Sierpiński-Stern triangle A191372. - Johannes W. Meijer, Jun 05 2011
Used to compute the total Steifel-Whitney cohomology class of the Real Projective space. This was an essential component of the proof that there are no product operations without zero divisors on R^n for n not equal to 1, 2, 4 or 8 (real numbers, complex numbers, quaternions, Cayley numbers), proved by Bott and Milnor. - Marcus Jaiclin, Feb 07 2012
T(n,k) = A134636(n,k) mod 2. - Reinhard Zumkeller, Nov 23 2012
T(n,k) = 1 - A219463(n,k), 0 <= k <= n. - Reinhard Zumkeller, Nov 30 2012
From Vladimir Shevelev, Dec 31 2013: (Start)
Also table of coefficients of polynomials s_n(x) of degree n which are defined by formula s_n(x) = Sum_{i=0..n} (binomial(n,i) mod 2)*x^k. These polynomials we naturally call Sierpiński's polynomials. They also are defined by the recursion: s_0(x)=1, s_(2*n+1)(x) = (x+1)*s_n(x^2), n>=0, and s_(2*n)(x) = s_n(x^2), n>=1.
Note that: s_n(1) = A001316(n),
s_n(2) = A001317(n),
s_n(3) = A100307(n),
s_n(4) = A001317(2*n),
s_n(5) = A100308(n),
s_n(6) = A100309(n),
s_n(7) = A100310(n),
s_n(8) = A100311(n),
s_n(9) = A100307(2*n),
s_n(10) = A006943(n),
s_n(16) = A001317(4*n),
s_n(25) = A100308(2*n), etc.
The equality s_n(10) = A006943(n) means that sequence A047999 is obtained from A006943 by the separation by commas of the digits of its terms. (End)
Comment from N. J. A. Sloane, Jan 18 2016: (Start)
Take a diamond-shaped region with edge length n from the top of the triangle, and rotate it by 45 degrees to get a square S_n. Here is S_6:
[1, 1, 1, 1, 1, 1]
[1, 0, 1, 0, 1, 0]
[1, 1, 0, 0, 1, 1]
[1, 0, 0, 0, 1, 0]
[1, 1, 1, 1, 0, 0]
[1, 0, 1, 0, 0, 0].
Then (i) S_n contains no square (parallel to the axes) with all four corners equal to 1 (cf. A227133); (ii) S_n can be constructed by using the greedy algorithm with the constraint that there is no square with that property; and (iii) S_n contains A064194(n) 1's. Thus A064194(n) is a lower bound on A227133(n). (End)
See A123098 for a multiplicative encoding of the rows, i.e., product of the primes selected by nonzero terms; e.g., 1 0 1 => 2^1 * 3^0 * 5^1. - M. F. Hasler, Sep 18 2016
From Valentin Bakoev, Jul 11 2020: (Start)
The Sierpinski's triangle with 2^n rows is a part of a lower triangular matrix M_n of dimension 2^n X 2^n. M_n is a block matrix defined recursively: M_1= [1, 0], [1, 1], and for n>1, M_n = [M_(n-1), O_(n-1)], [M_(n-1), M_(n-1)], where M_(n-1) is a block matrix of the same type, but of dimension 2^(n-1) X 2^(n-1), and O_(n-1) is the zero matrix of dimension 2^(n-1) X 2^(n-1). Here is how M_1, M_2 and M_3 look like:
1 0 1 0 0 0 1 0 0 0 0 0 0 0
1 1 1 1 0 0 1 1 0 0 0 0 0 0 - It is seen the self-similarity of the
1 0 1 0 1 0 1 0 0 0 0 0 matrices M_1, M_2, ..., M_n, ...,
1 1 1 1 1 1 1 1 0 0 0 0 analogously to the Sierpinski's fractal.
1 0 0 0 1 0 0 0
1 1 0 0 1 1 0 0
1 0 1 0 1 0 1 0
1 1 1 1 1 1 1 1
M_n can also be defined as M_n = M_1 X M_(n-1) where X denotes the Kronecker product. M_n is an important matrix in coding theory, cryptography, Boolean algebra, monotone Boolean functions, etc. It is a transformation matrix used in computing the algebraic normal form of Boolean functions. Some properties and links concerning M_n can be seen in LINKS. (End)
Sierpinski's gasket has fractal (Hausdorff) dimension log(A000217(2))/log(2) = log(3)/log(2) = 1.58496... (and cf. A020857). This gasket is the first of a family of gaskets formed by taking the Pascal triangle (A007318) mod j, j >= 2 (see CROSSREFS). For prime j, the dimension of the gasket is log(A000217(j))/log(j) = log(j(j + 1)/2)/log(j) (see Reiter and Bondarenko references). - Richard L. Ollerton, Dec 14 2021

Examples

			Triangle begins:
              1,
             1,1,
            1,0,1,
           1,1,1,1,
          1,0,0,0,1,
         1,1,0,0,1,1,
        1,0,1,0,1,0,1,
       1,1,1,1,1,1,1,1,
      1,0,0,0,0,0,0,0,1,
     1,1,0,0,0,0,0,0,1,1,
    1,0,1,0,0,0,0,0,1,0,1,
   1,1,1,1,0,0,0,0,1,1,1,1,
  1,0,0,0,1,0,0,0,1,0,0,0,1,
  ...
		

References

  • Boris A. Bondarenko, Generalized Pascal Triangles and Pyramids (in Russian), FAN, Tashkent, 1990, ISBN 5-648-00738-8.
  • Brand, Neal; Das, Sajal; Jacob, Tom. The number of nonzero entries in recursively defined tables modulo primes. Proceedings of the Twenty-first Southeastern Conference on Combinatorics, Graph Theory, and Computing (Boca Raton, FL, 1990). Congr. Numer. 78 (1990), 47--59. MR1140469 (92h:05004).
  • John W. Milnor and James D. Stasheff, Characteristic Classes, Princeton University Press, 1974, pp. 43-49 (sequence appears on p. 46).
  • H.-O. Peitgen, H. Juergens and D. Saupe: Chaos and Fractals (Springer-Verlag 1992), p. 408.
  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; Chapter 3.

Crossrefs

Sequences based on the triangles formed by reading Pascal's triangle mod m: (this sequence) (m = 2), A083093 (m = 3), A034931 (m = 4), A095140 (m = 5), A095141 (m = 6), A095142 (m = 7), A034930(m = 8), A095143 (m = 9), A008975 (m = 10), A095144 (m = 11), A095145 (m = 12), A275198 (m = 14), A034932 (m = 16).
Other versions: A090971, A038183.
From Johannes W. Meijer, Jun 05 2011: (Start)
A106344 is a skew version of this triangle.
Triangle sums (see the comments): A001316 (Row1; Related to Row2), A002487 (Related to Kn11, Kn12, Kn13, Kn21, Kn22, Kn23), A007306 (Kn3, Kn4), A060632 (Fi1, Fi2), A120562 (Ca1, Ca2), A112970 (Gi1, Gi2), A127830 (Ze3, Ze4). (End)

Programs

  • Haskell
    import Data.Bits (xor)
    a047999 :: Int -> Int -> Int
    a047999 n k = a047999_tabl !! n !! k
    a047999_row n = a047999_tabl !! n
    a047999_tabl = iterate (\row -> zipWith xor ([0] ++ row) (row ++ [0])) [1]
    -- Reinhard Zumkeller, Dec 11 2011, Oct 24 2010
    
  • Magma
    A047999:= func< n,k | BitwiseAnd(n-k, k) eq 0 select 1 else 0 >;
    [A047999(n,k): k in [0..n], n in [0..15]]; // G. C. Greubel, Dec 03 2024
  • Maple
    # Maple code for first M rows (here M=10) - N. J. A. Sloane, Feb 03 2016
    ST:=[1,1,1]; a:=1; b:=2; M:=10;
    for n from 2 to M do ST:=[op(ST),1];
    for i from a to b-1 do ST:=[op(ST), (ST[i+1]+ST[i+2]) mod 2 ]; od:
    ST:=[op(ST),1];
    a:=a+n; b:=a+n; od:
    ST; # N. J. A. Sloane
    # alternative
    A047999 := proc(n,k)
        modp(binomial(n,k),2) ;
    end proc:
    seq(seq(A047999(n,k),k=0..n),n=0..12) ; # R. J. Mathar, May 06 2016
  • Mathematica
    Mod[ Flatten[ NestList[ Prepend[ #, 0] + Append[ #, 0] &, {1}, 13]], 2] (* Robert G. Wilson v, May 26 2004 *)
    rows = 14; ca = CellularAutomaton[60, {{1}, 0}, rows-1]; Flatten[ Table[ca[[k, 1 ;; k]], {k, 1, rows}]] (* Jean-François Alcover, May 24 2012 *)
    Mod[#,2]&/@Flatten[Table[Binomial[n,k],{n,0,20},{k,0,n}]] (* Harvey P. Dale, Jun 26 2019 *)
  • PARI
    \\ Recurrence for Pascal's triangle mod p, here p = 2.
    p = 2; s=13; T=matrix(s,s); T[1,1]=1;
    for(n=2,s, T[n,1]=1; for(k=2,n, T[n,k] = (T[n-1,k-1] + T[n-1,k])%p ));
    for(n=1,s,for(k=1,n,print1(T[n,k],", "))) \\ Gerald McGarvey, Oct 10 2009
    
  • PARI
    A011371(n)=my(s);while(n>>=1,s+=n);s
    T(n,k)=A011371(n)==A011371(k)+A011371(n-k) \\ Charles R Greathouse IV, Aug 09 2013
    
  • PARI
    T(n,k)=bitand(n-k,k)==0 \\ Charles R Greathouse IV, Aug 11 2016
    
  • Python
    def A047999_T(n,k):
        return int(not ~n & k) # Chai Wah Wu, Feb 09 2016
    

Formula

Lucas's Theorem is that T(n,k) = 1 if and only if the 1's in the binary expansion of k are a subset of the 1's in the binary expansion of n; or equivalently, k AND NOT n is zero, where AND and NOT are bitwise operators. - Chai Wah Wu, Feb 09 2016 and N. J. A. Sloane, Feb 10 2016
Sum_{k>=0} T(n, k) = A001316(n) = 2^A000120(n).
T(n,k) = T(n-1,k-1) XOR T(n-1,k), 0 < k < n; T(n,0) = T(n,n) = 1. - Reinhard Zumkeller, Dec 13 2009
T(n,k) = (T(n-1,k-1) + T(n-1,k)) mod 2 = |T(n-1,k-1) - T(n-1,k)|, 0 < k < n; T(n,0) = T(n,n) = 1. - Rick L. Shepherd, Feb 23 2018
From Vladimir Shevelev, Dec 31 2013: (Start)
For polynomial {s_n(x)} we have
s_0(x)=1; for n>=1, s_n(x) = Product_{i=1..A000120(n)} (x^(2^k_i) + 1),
if the binary expansion of n is n = Sum_{i=1..A000120(n)} 2^k_i;
G.f. Sum_{n>=0} s_n(x)*z^n = Product_{k>=0} (1 + (x^(2^k)+1)*z^(2^k)) (0
Let x>1, t>0 be real numbers. Then
Sum_{n>=0} 1/s_n(x)^t = Product_{k>=0} (1 + 1/(x^(2^k)+1)^t);
Sum_{n>=0} (-1)^A000120(n)/s_n(x)^t = Product_{k>=0} (1 - 1/(x^(2^k)+1)^t).
In particular, for t=1, x>1, we have
Sum_{n>=0} (-1)^A000120(n)/s_n(x) = 1 - 1/x. (End)
From Valentin Bakoev, Jul 11 2020: (Start)
(See my comment about the matrix M_n.) Denote by T(i,j) the number in the i-th row and j-th column of M_n (0 <= i, j < 2^n). When i>=j, T(i,j) is the j-th number in the i-th row of the Sierpinski's triangle. For given i and j, we denote by k the largest integer of the type k=2^m and k
T(i,0) = T(i,i) = 1, or
T(i,j) = 0 if i < j, or
T(i,j) = T(i-k,j), if j < k, or
T(i,j) = T(i-k,j-k), if j >= k.
Thus, for given i and j, T(i,j) can be computed in O(log_2(i)) steps. (End)

Extensions

Additional links from Lekraj Beedassy, Jan 22 2004

A006046 Total number of odd entries in first n rows of Pascal's triangle: a(0) = 0, a(1) = 1, a(2k) = 3*a(k), a(2k+1) = 2*a(k) + a(k+1). a(n) = Sum_{i=0..n-1} 2^wt(i).

Original entry on oeis.org

0, 1, 3, 5, 9, 11, 15, 19, 27, 29, 33, 37, 45, 49, 57, 65, 81, 83, 87, 91, 99, 103, 111, 119, 135, 139, 147, 155, 171, 179, 195, 211, 243, 245, 249, 253, 261, 265, 273, 281, 297, 301, 309, 317, 333, 341, 357, 373, 405, 409, 417, 425, 441, 449, 465, 481, 513, 521
Offset: 0

Keywords

Comments

The graph has a blancmange or Takagi appearance. For the asymptotics, see the references by Flajolet with "Mellin" in the title. - N. J. A. Sloane, Mar 11 2021
The following alternative construction of this sequence is due to Thomas Nordhaus, Oct 31 2000: For each n >= 0 let f_n be the piecewise linear function given by the points (k /(2^n), a(k) / 3^n), k = 0, 1, ..., 2^n. f_n is a monotonic map from the interval [0,1] into itself, f_n(0) = 0, f_n(1) = 1. This sequence of functions converges uniformly. But the limiting function is not differentiable on a dense subset of this interval.
I submitted a problem to the Amer. Math. Monthly about an infinite family of non-convex sequences that solve a recurrence that involves minimization: a(1) = 1; a(n) = max { ua(k) + a(n-k) | 1 <= k <= n/2 }, for n > 1; here u is any real-valued constant >= 1. The case u=2 gives the present sequence. Cf. A130665 - A130667. - Don Knuth, Jun 18 2007
a(n) = sum of (n-1)-th row terms of triangle A166556. - Gary W. Adamson, Oct 17 2009
From Gary W. Adamson, Dec 06 2009: (Start)
Let M = an infinite lower triangular matrix with (1, 3, 2, 0, 0, 0, ...) in every column shifted down twice:
1;
3;
2; 1;
0, 3;
0, 2, 1;
0, 0, 3;
0, 0, 2, 1;
0, 0, 0, 3;
0, 0, 0, 2, 1;
...
This sequence starting with "1" = lim_{n->infinity} M^n, the left-shifted vector considered as a sequence. (End)
a(n) is also the sum of all entries in rows 0 to n of Sierpiński's triangle A047999. - Reinhard Zumkeller, Apr 09 2012
The production matrix of Dec 06 2009 is equivalent to the following: Let p(x) = (1 + 3x + 2x^2). The sequence = P(x) * p(x^2) * p(x^4) * p(x^8) * .... The sequence divided by its aerated variant = (1, 3, 2, 0, 0, 0, ...). - Gary W. Adamson, Aug 26 2016
Also the total number of ON cells, rows 1 through n, for cellular automaton Rule 90 (Cf. A001316, A038183, also Mathworld Link). - Bradley Klee, Dec 22 2018

References

  • S. R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.16.
  • Flajolet, Philippe, and Mordecai Golin. "Mellin transforms and asymptotics." Acta Informatica 31.7 (1994): 673-696.
  • Flajolet, Philippe, Mireille Régnier, and Robert Sedgewick. "Some uses of the Mellin integral transform in the analysis of algorithms." in Combinatorial algorithms on words. Springer, 1985. 241-254.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Partial sums of A001316.
See A130665 for Sum 3^wt(n).
a(n) = A074330(n-1) + 1 for n >= 2. A080978(n) = 2*a(n) + 1. Cf. A080263.
Sequences of form a(n) = r*a(ceiling(n/2)) + s*a(floor(n/2)), a(1)=1, for (r,s) = (1,1), (1,2), (2,1), (1,3), (2,2), (3,1), (1,4), (2,3), (3,2), (4,1): A000027, A006046, A064194, A130665, A073121, A268524, A116520, A268525, A268526, A268527.

Programs

  • Haskell
    a006046 = sum . concat . (`take` a047999_tabl)
    -- Reinhard Zumkeller, Apr 09 2012
    
  • Magma
    [0] cat [n le 1 select 1 else 2*Self(Floor(n/2)) + Self(Floor(Ceiling(n/2))): n in [1..60]]; // Vincenzo Librandi, Aug 30 2016
  • Maple
    f:=proc(n) option remember;
    if n <= 1 then n elif n mod 2 = 0 then 3*f(n/2)
    else 2*f((n-1)/2)+f((n+1)/2); fi; end;
    [seq(f(n),n=0..130)]; # N. J. A. Sloane, Jul 29 2014
  • Mathematica
    f[n_] := Sum[ Mod[ Binomial[n, k], 2], {k, 0, n} ]; Table[ Sum[ f[k], {k, 0, n} ], {n, 0, 100} ]
    Join[{0},Accumulate[Count[#,?OddQ]&/@Table[Binomial[n,k],{n,0,60},{k,0,n}]]] (* _Harvey P. Dale, Dec 10 2014 *)
    FoldList[Plus, 0, Total /@ CellularAutomaton[90, Join[Table[0, {#}], {1}, Table[0, {#}]], #]][[2 ;; -1]] &@50 (* Bradley Klee, Dec 23 2018 *)
    Join[{0}, Accumulate[2^DigitCount[Range[0, 127], 2, 1]]] (* Paolo Xausa, Oct 24 2024 *)
    Join[{0}, Accumulate[2^Nest[Join[#, #+1]&, {0}, 7]]] (* Paolo Xausa, Oct 24 2024, after IWABUCHI Yu(u)ki in A000120 *)
  • PARI
    A006046(n)={ n<2 & return(n); A006046(n\2)*3+if(n%2,1<M. F. Hasler, May 03 2009
    
  • PARI
    a(n) = if(!n, 0, my(r=0, t=1); forstep(i=logint(n, 2), 0, -1, r*=3; if(bittest(n, i), r+=t; t*=2)); r); \\ Ruud H.G. van Tol, Jul 06 2024
    
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A006046(n):return n if n<=1 else 2*A006046((n-1)//2)+A006046((n+1)//2)if n%2 else 3*A006046(n//2) # Guillermo Hernández, Dec 31 2023
    
  • Python
    from math import prod
    def A006046(n):
        d = list(map(lambda x:int(x)+1,bin(n)[:1:-1]))
        return sum((b-1)*prod(d[a:])*3**a for a, b in enumerate(d))>>1 # Chai Wah Wu, Aug 13 2025
    

Formula

a(n) = Sum_{k=0..n-1} 2^A000120(k). - Paul Barry, Jan 05 2005; simplified by N. J. A. Sloane, Apr 05 2014
For asymptotics see Stolarsky (1977). - N. J. A. Sloane, Apr 05 2014
a(n) = a(n-1) + A001316(n-1). a(2^n) = 3^n. - Henry Bottomley, Apr 05 2001
a(n) = n^(log_2(3))*G(log_2(n)) where G(x) is a function of period 1 defined by its Fourier series. - Benoit Cloitre, Aug 16 2002; formula modified by S. R. Finch, Dec 31 2007
G.f.: (x/(1-x))*Product_{k>=0} (1 + 2*x^2^k). - Ralf Stephan, Jun 01 2003; corrected by Herbert S. Wilf, Jun 16 2005
a(1) = 1, a(n) = 2*a(floor(n/2)) + a(ceiling(n/2)).
a(n) = 3*a(floor(n/2)) + (n mod 2)*2^A000120(n-1). - M. F. Hasler, May 03 2009
a(n) = Sum_{k=0..floor(log_2(n))} 2^k * A360189(n-1,k). - Alois P. Heinz, Mar 06 2023

Extensions

More terms from James Sellers, Aug 21 2000
Definition expanded by N. J. A. Sloane, Feb 16 2016

A116520 a(0) = 0, a(1) = 1; a(n) = max { 4*a(k) + a(n-k) | 1 <= k <= n/2 }, for n > 1.

Original entry on oeis.org

0, 1, 5, 9, 25, 29, 45, 61, 125, 129, 145, 161, 225, 241, 305, 369, 625, 629, 645, 661, 725, 741, 805, 869, 1125, 1141, 1205, 1269, 1525, 1589, 1845, 2101, 3125, 3129, 3145, 3161, 3225, 3241, 3305, 3369, 3625, 3641, 3705, 3769, 4025, 4089, 4345, 4601, 5625
Offset: 0

Author

Roger L. Bagula, Mar 15 2006

Keywords

Comments

Equivalently, a(n) = r*a(ceiling(n/2)) + s*a(floor(n/2)), a(0)=0, a(1)=1, for (r,s) = (1,4). - N. J. A. Sloane, Feb 16 2016
A 5-divide version of A084230.
Zero together with the partial sums of A102376. - Omar E. Pol, May 05 2010
Also, total number of cubic ON cells after n generations in a three-dimensional cellular automaton in which A102376(n-1) gives the number of cubic ON cells in the n-th level of the structure starting from the top. An ON cell remains ON forever. The structure looks like an irregular stepped pyramid, with n >= 1. - Omar E. Pol, Feb 13 2015
From Gary W. Adamson, Aug 27 2016: (Start)
The formula of Mar 26 2010 is equivalent to lim_{k->infinity} M^k of the following production matrix M:
1, 0, 0, 0, 0, 0, ...
5, 0, 0, 0, 0, 0, ...
4, 1, 0, 0, 0, 0, ...
0, 5, 0, 0, 0, 0, ...
0, 4, 1, 0, 0, 0, ...
0, 0, 5, 0, 0, 0, ...
0, 0, 4, 1, 0, 0, ...
0, 0, 0, 5, 0, 0, ...
...
The sequence with offset 1 divided by its aerated variant is (1, 5, 4, 0, 0, 0, ...). (End)

Crossrefs

Sequences of the form a(n) = r*a(ceiling(n/2)) + s*a(floor(n/2)), a(1)=1, for (r,s) = (1,1), (1,2), (2,1), (1,3), (2,2), (3,1), (1,4), (2,3), (3,2), (4,1): A000027, A006046, A064194, A130665, A073121, A268524, A116520, A268525, A268526, A268527.

Programs

  • Haskell
    import Data.List (transpose)
    a116520 n = a116520_list !! n
    a116520_list = 0 : zs where
       zs = 1 : (concat $ transpose
                          [zipWith (+) vs zs, zipWith (+) vs $ tail zs])
          where vs = map (* 4) zs
    -- Reinhard Zumkeller, Apr 18 2012
  • Maple
    a:=proc(n) if n=0 then 0 elif n=1 then 1 elif n mod 2 = 0 then 5*a(n/2) else 4*a((n-1)/2)+a((n+1)/2) fi end: seq(a(n),n=0..52);
  • Mathematica
    b[0] := 0 b[1] := 1 b[n_?EvenQ] := b[n] = 5*b[n/2] b[n_?OddQ] := b[n] = 4*b[(n - 1)/2] + b[(n + 1)/2] a = Table[b[n], {n, 1, 25}]

Formula

a(0) = 1, a(1) = 1; thereafter a(2n) = 5a(n) and a(2n+1) = 4a(n) + a(n+1).
Let r(x) = (1 + 5x + 4x^2). Then (1 + 5x + 9x^2 + 25x^3 + ...) = r(x) * r(x^2) * r(x^4) * r(x^8) * ... . - Gary W. Adamson, Mar 26 2010
a(n) = Sum_{k=0..n-1} 4^wt(k), where wt = A000120. - Mike Warburton, Mar 14 2019
a(n) = Sum_{k=0..floor(log_2(n))} 4^k*A360189(n-1,k). - Alois P. Heinz, Mar 06 2023

Extensions

Edited by N. J. A. Sloane, Apr 16 2006, Jul 02 2008

A227133 Given a square grid with side n consisting of n^2 cells (or points), a(n) is the maximum number of points that can be painted so that no four of the painted ones form a square with sides parallel to the grid.

Original entry on oeis.org

1, 3, 7, 12, 17, 24, 32, 41, 51, 61, 73, 85, 98
Offset: 1

Author

Heinrich Ludwig, Jul 06 2013

Keywords

Comments

a(1) through a(9) were found by an exhaustive computational search for all solutions. This sequence is complementary to A152125: A152125(n) + A227133(n) = n^2.
A064194(n) is a lower bound on a(n) (see the comments in A047999). - N. J. A. Sloane, Jan 18 2016
a(11) >= 71 (by extending the n=10 solution towards the southeast). - N. J. A. Sloane, Feb 12 2016
a(11) >= 73, a(12) >= 85, a(13) >= 98, a(14) >= 112, a(15) >= 127, a(16) >= 142 (see links). These lower bounds were obtained using tabu search and simulated annealing via the Ascension Optimization Framework. - Peter Karpov, Feb 22 2016; corrected Jun 04 2016
Note that n is the number of cells along each edge of the grid. The case n=1 corresponds to a single square cell, n=2 to a 2 X 2 array of four square cells. The standard chessboard is the case n=8. It is easy to get confused and to think of the case n=2 as a 3 X 3 grid of dots (the vertices of the squares in the grid). Don't think like that! - N. J. A. Sloane, Apr 03 2016
a(12) = 85 and a(13) = 98 were obtained with a MIP model, solved with Gurobi in 141 days on 32 cores. - Simon Felix, Nov 22 2019
a(17) >= 158, a(18) >= 174, a(19) >= 192, a(20) >= 210. These lower bounds were obtained using simulated annealing. - Dmitry Kamenetsky, Dec 07 2024

Examples

			n=9. A maximum of a(9) = 51 points (X) of 81 can be painted while 30 (.) must be left unpainted. The following 9 X 9 square is an example:
     . X X X X X . X .
     X . X . . X X X X
     X X . . X . X . X
     X . . X X X X . .
     X X X . X . . X X
     X . X X X . . . X
     . X X . . X X . X
     X X . X . X . X X
     . X X X X X X X .
Here there is no subsquare with all vertices = X and having sides parallel to the axes.
		

Crossrefs

Cf. A152125 (the complementary problem), A000330, A240443 (when all squares must be avoided, not just those aligned with the grid).
See also A047999, A064194.
For a lower bound see A269745.
For analogs that avoid triangles in the square grid see A271906, A271907.
For an equilateral triangular grid analog see A227308 (and A227116).
For the three-dimensional analog see A268239.

Programs

  • Mathematica
    a[n_] := Block[{m, qq, nv = n^2, ne}, qq = Flatten[1 + Table[n*x + y + {0, s, s*n, s*(n + 1)}, {x, 0, n-2}, {y, 0, n-2}, {s, Min[n-x, n-y] -1}], 2]; ne = Length@qq; m = Table[0, {ne}, {nv}]; Do[m[[i, qq[[i]]]] = 1, {i, ne}]; Total@ Quiet@ LinearProgramming[Table[-1, {nv}], m, Table[{3, -1}, {ne}], Table[{0, 1}, {nv}], Integers]]; Array[a,8] (* Giovanni Resta, Jul 14 2013 *)

Extensions

a(10) from Giovanni Resta, Jul 14 2013
a(11) from Paul Tabatabai using integer programming, Sep 25 2018
a(12)-a(13) from Simon Felix using integer programming, Nov 22 2019

A073121 a(n) = r*a(ceiling(n/2)) + s*a(floor(n/2)) with a(1)=1 and (r,s)=(2,2).

Original entry on oeis.org

1, 4, 10, 16, 28, 40, 52, 64, 88, 112, 136, 160, 184, 208, 232, 256, 304, 352, 400, 448, 496, 544, 592, 640, 688, 736, 784, 832, 880, 928, 976, 1024, 1120, 1216, 1312, 1408, 1504, 1600, 1696, 1792, 1888, 1984, 2080, 2176, 2272, 2368, 2464, 2560, 2656, 2752
Offset: 1

Author

Jeffrey Shallit, Aug 25 2002

Keywords

Comments

A recurrence occurring in the analysis of a regular expression algorithm.

Examples

			a(1)=1, a(2) = 2*(a(1)+a(1)) = 4, a(3) = 2*(a(2)+a(1)) = 10.
		

References

  • K. Ellul, J. Shallit and M.-w. Wang, Regular expressions: new results and open problems, in Descriptional Complexity of Formal Systems (DCFS), Proceedings of workshop, London, Ontario, Canada, 21-24 August 2002, pp. 17-34.

Crossrefs

Sequences of form a(n) = r*a(ceiling(n/2)) + s*a(floor(n/2)), a(1)=1, for (r,s) = (1,1), (1,2), (2,1), (1,3), (2,2), (3,1), (1,4), (2,3), (3,2), (4,1): A000027, A006046, A064194, A130665, A073121, A268524, A116520, A268525, A268526, A268527.

Programs

  • Haskell
    a073121 n = a053644 n * (fromIntegral n + 2 * a053645 n)
    -- Reinhard Zumkeller, Mar 23 2012
    
  • Maple
    a:= proc(n) option remember; `if`(n=1, 1,
          2*((m-> a(m)+a(n-m))(iquo(n, 2))))
        end:
    seq(a(n), n=1..70);  # Alois P. Heinz, Feb 01 2015
  • Mathematica
    a[n_] := a[n] = If[n == 1, 1, 2*(a[Quotient[n, 2]] + a[n - Quotient[n, 2]])]; Table[a[n], {n, 1, 70}] (* Jean-François Alcover, Feb 24 2016, after Alois P. Heinz *)
    a[ n_] := If[ n < 1, 0, Module[{m = 1, A = 1}, While[m < n, m *= 2; A = (Normal[A] /. x -> x^2) 2 (1 + x)^2 - 1 + O[x]^m]; Coefficient[A, x, n - 1]]]; (* Michael Somos, Jul 04 2017 *)
  • PARI
    {a(n) = n--; if( n<0, 0, my(m=1, A = 1 + O(x)); while(m<=n, m*=2; A = subst(A, x, x^2) * 2 * (1 + x)^2 - 1); polcoeff(A, n))}; /* Michael Somos, Jul 04 2017 */

Formula

a(n) = 2*(a(floor(n/2)) + a(ceiling(n/2))) for n >= 2; alternatively, a(n) = 2^c(n+2b) where n = 2^c + b, 0 <= b < 2^c.
a(n) == 1 (mod 3), a(n+1)-a(n) = 3*A053644(n). If k >= 1: a(2^k)=4^k, a(3*2^k)=(10/9)*4^k. More generally a(m*2^k) = a(m)*4^k. Hence for any n, n^2 <= a(n) <= C*n^2 where C is a constant 1.125 < C < 1.14 and it seems that C = lim_{k->infinity} a(A001045(k))/A001045(k)^2 where A001045(k) =(2^n - (-1)^n)/3 is the Jacobsthal sequence. In other words, in the range 2^k <= n <= 2^(k+1) the maximum of a(n)/n^2 is reached for the only possible n in the Jacobsthal sequence. - Benoit Cloitre, Aug 26 2002
For any n, n^2 <= a(n) <= 9/8 * n^2. - Arnoud van der Leer, Sep 01 2019
a(n) = 2*(a(floor(n/2)) + a(ceiling(n/2))) for n >= 2; alternatively, a(n) = 2^c(n+2b) where n = 2^c + b, 0 <= b < 2^c
G.f.: 3*x/(1-x)^2 * ((2*x+1)/3 + Sum_{k>=1} 2^(k-1)*x^2^k). - Ralf Stephan, Apr 18 2003
G.f.: A(x) = 2 * (1/x + 2 + x) * A(x^2) - x. - Michael Somos, Jul 04 2017

Extensions

Edited by N. J. A. Sloane, Feb 16 2016

A268524 a(n) = r*a(ceiling(n/2))+s*a(floor(n/2)) with a(1)=1 and (r,s)=(3,1).

Original entry on oeis.org

1, 4, 13, 16, 43, 52, 61, 64, 145, 172, 199, 208, 235, 244, 253, 256, 499, 580, 661, 688, 769, 796, 823, 832, 913, 940, 967, 976, 1003, 1012, 1021, 1024, 1753, 1996, 2239, 2320, 2563, 2644, 2725, 2752, 2995, 3076, 3157, 3184, 3265, 3292, 3319, 3328, 3571, 3652, 3733, 3760, 3841, 3868, 3895
Offset: 1

Author

N. J. A. Sloane, Feb 16 2016

Keywords

Comments

Number of triples 0 <= i, j, k < n such that bitwise AND of all pairs (i, j), (j, k), (k, i) is 0. - Peter Karpov, Mar 01 2016
Start with A = [[[1]]], iteratively replace every element Aijk with Aijk * [[[1, 1], [1, 0]], [[1, 0], [0, 0]]]. a(n) is the sum of the resulting array inside the cubic region i, j, k < n. - Peter Karpov, Mar 01 2016

Crossrefs

Sequences of form a(n) = r*a(ceiling(n/2))+s*a(floor(n/2)) with a(1)=1 and (r,s) = (1,1), (1,2), (2,1), (1,3), (2,2), (3,1), (1,4), (2,3), (3,2), (4,1): A000027, A006046, A064194, A130665, A073121, A268524, A116520, A268525, A268526, A268527.

Programs

  • PARI
    a(n) = if (n==1, 1, 3*a(ceil(n/2)) + a(floor(n/2))); \\ Michel Marcus, Mar 24 2016

A268525 a(n) = r*a(ceiling(n/2))+s*a(floor(n/2)) with a(1)=1 and (r,s)=(2,3).

Original entry on oeis.org

1, 5, 13, 25, 41, 65, 89, 125, 157, 205, 253, 325, 373, 445, 517, 625, 689, 785, 881, 1025, 1121, 1265, 1409, 1625, 1721, 1865, 2009, 2225, 2369, 2585, 2801, 3125, 3253, 3445, 3637, 3925, 4117, 4405, 4693, 5125, 5317, 5605, 5893, 6325, 6613, 7045, 7477, 8125, 8317, 8605, 8893, 9325, 9613, 10045
Offset: 1

Author

N. J. A. Sloane, Feb 16 2016

Keywords

Crossrefs

Sequences of form a(n) = r*a(ceiling(n/2))+s*a(floor(n/2)) with a(1)=1 and (r,s) = (1,1), (1,2), (2,1), (1,3), (2,2), (3,1), (1,4), (2,3), (3,2), (4,1): A000027, A006046, A064194, A130665, A073121, A268524, A116520, A268525, A268526, A268527.

Programs

  • Magma
    [n le 1 select 1 else 2*Self(Ceiling(n/2))+3*Self(Floor(n/2)): n in [1..60]]; // Vincenzo Librandi, Aug 30 2016
  • PARI
    a(n) = if (n==1, 1, 2*a(ceil(n/2))+3*a(floor(n/2))); \\ Michel Marcus, Aug 30 2016
    

A268526 a(n) = r*a(ceiling(n/2))+s*a(floor(n/2)) with a(1)=1 and (r,s)=(3,2).

Original entry on oeis.org

1, 5, 17, 25, 61, 85, 109, 125, 233, 305, 377, 425, 497, 545, 593, 625, 949, 1165, 1381, 1525, 1741, 1885, 2029, 2125, 2341, 2485, 2629, 2725, 2869, 2965, 3061, 3125, 4097, 4745, 5393, 5825, 6473, 6905, 7337, 7625, 8273, 8705, 9137, 9425, 9857, 10145, 10433, 10625, 11273, 11705, 12137, 12425
Offset: 1

Author

N. J. A. Sloane, Feb 16 2016

Keywords

Crossrefs

Sequences of form a(n) = r*a(ceiling(n/2))+s*a(floor(n/2)) with a(1)=1 and (r,s) = (1,1), (1,2), (2,1), (1,3), (2,2), (3,1), (1,4), (2,3), (3,2), (4,1): A000027, A006046, A064194, A130665, A073121, A268524, A116520, A268525, A268526, A268527.

Programs

  • Magma
    [n le 1 select 1 else 3*Self(Ceiling(n/2))+2*Self(Floor(n/2)): n in [1..60]]; // Vincenzo Librandi, Aug 30 2016
  • PARI
    a(n) = if (n==1, 1, 3*a(ceil(n/2))+2*a(floor(n/2))); \\ Michel Marcus, Aug 30 2016
    

A268527 a(n) = r*a(ceiling(n/2))+s*a(floor(n/2)) with a(1)=1 and (r,s)=(4,1).

Original entry on oeis.org

1, 5, 21, 25, 89, 105, 121, 125, 381, 445, 509, 525, 589, 605, 621, 625, 1649, 1905, 2161, 2225, 2481, 2545, 2609, 2625, 2881, 2945, 3009, 3025, 3089, 3105, 3121, 3125, 7221, 8245, 9269, 9525, 10549, 10805, 11061, 11125, 12149, 12405, 12661, 12725, 12981, 13045, 13109, 13125, 14149, 14405
Offset: 1

Author

N. J. A. Sloane, Feb 16 2016

Keywords

Crossrefs

Sequences of form a(n) = r*a(ceiling(n/2))+s*a(floor(n/2)) with a(1)=1 and (r,s) = (1,1), (1,2), (2,1), (1,3), (2,2), (3,1), (1,4), (2,3), (3,2), (4,1): A000027, A006046, A064194, A130665, A073121, A268524, A116520, A268525, A268526, A268527.

Programs

  • PARI
    a(n) = if (n==1, 1, 4*a(ceil(n/2))+a(floor(n/2))); \\ Michel Marcus, Aug 30 2016

A267584 a(0)=1; thereafter a(n) = 2^(1 + number of zeros in binary expansion of n).

Original entry on oeis.org

1, 2, 4, 2, 8, 4, 4, 2, 16, 8, 8, 4, 8, 4, 4, 2, 32, 16, 16, 8, 16, 8, 8, 4, 16, 8, 8, 4, 8, 4, 4, 2, 64, 32, 32, 16, 32, 16, 16, 8, 32, 16, 16, 8, 16, 8, 8, 4, 32, 16, 16, 8, 16, 8, 8, 4, 16, 8, 8, 4, 8, 4, 4, 2, 128, 64, 64, 32, 64, 32, 32, 16, 64
Offset: 0

Author

N. J. A. Sloane, Jan 17 2016

Keywords

Examples

			12 = 1100 in binary, which contains two 0's, so a(12) = 2^3 = 8.
		

Crossrefs

Partial sums give A064194.
Cf. A023416.

Programs

  • Mathematica
    Join[{1},Table[2^(1+DigitCount[n,2,0]),{n,80}]] (* Harvey P. Dale, Oct 08 2023 *)

Formula

For n >= 1, a(n) = 2^(1+A023416(n)).
Showing 1-10 of 12 results. Next