Displaying 1-10 of 63 results found.
Values of n such that A006046(n)/n^theta, where theta=log(3)/log(2), is a local minimum, computed according to Harborth's recurrence.
+20
10
1, 3, 5, 11, 21, 43, 87, 173, 347, 693, 1387, 2775, 5549, 11099, 22197, 44395, 88789, 177579, 355159, 710317, 1420635, 2841269, 5682539, 11365079, 22730157, 45460315, 90920629, 181841259, 363682519, 727365037, 1454730075
COMMENTS
Harborth's recurrence can miss local minima that are 2 less than values in this sequence. A complete listing of cumulative minima is given by A084230.
Cumulative minima of A006046(n)/n^theta, where theta=log(3)/log(2), is a local minimum.
+20
8
1, 3, 5, 11, 21, 43, 87, 171, 173, 347, 693, 1387, 2775, 5547, 5549, 11099, 22197, 44395, 88789, 177579, 355159, 710315, 710317, 1420635, 2841269, 5682539, 11365079, 22730155, 22730157, 45460315, 90920629, 181841259, 363682519
COMMENTS
Includes terms missed by Horbarth's recurrence.
1, 3, 7, 11, 19, 23, 31, 39, 55, 59, 67, 75, 91, 99, 115, 131, 163, 167, 175, 183, 199, 207, 223, 239, 271, 279, 295, 311, 343, 359, 391, 423, 487, 491, 499, 507, 523, 531, 547, 563, 595, 603, 619, 635, 667, 683, 715, 747, 811, 819, 835, 851, 883, 899, 931, 963
COMMENTS
The number of edges in A080973-trees.
MATHEMATICA
Map[2 # + 1 &, {0}~Join~Accumulate@ Map[Count[#, _?OddQ] &, Table[Binomial[n, k], {n, 0, 54}, {k, 0, n}]]] (* Michael De Vlieger, Oct 30 2022 *)
1, 5, 11, 37, 103, 317, 967, 2869, 8639, 25853, 77623, 232997, 698735, 2096461, 6288871, 18867125, 56600351, 169802077, 509408279, 1528220741, 4584666319, 13753990765, 41261980487, 123785957845, 371357840767, 1114073555069
a(n) = b(n+2) + b(n), where b(n) = A006046(n) is the sequence defined by b(0)=0, b(1)=1, b(n) = 2*b((n-1)/2) + b((n+1)/2) for n =3,5,7,... and b(n) = 3*b(n/2) for n =2,4,6,....
+20
1
3, 6, 12, 16, 24, 30, 42, 48, 60, 66, 78, 86, 102, 114, 138, 148, 168, 174, 186, 194, 210, 222, 246, 258, 282, 294, 318, 334, 366, 390, 438, 456, 492, 498, 510, 518, 534, 546, 570, 582, 606, 618, 642, 658, 690, 714, 762, 782, 822, 834, 858, 874, 906, 930, 978
COMMENTS
A similar definition applied to the Fibonacci sequence ( A000045) leads to the Lucas sequence ( A000032). b(n) in the definition is also the number of odd entries in the first n rows of the Pascal triangle.
MAPLE
b:=proc(n) option remember: if n = 0 then 0 elif n=1 then 1 elif n mod 2 = 0 then 3*b(n/2) else 2*b((n-1)/2)+b((n+1)/2) fi end: a:=n->b(n+2)+b(n): seq(a(n), n=0..60);
MATHEMATICA
b[0] := 0 b[1] := 1; b[n_?EvenQ] := b[n] = 3*b[n/2]; b[n_?OddQ] := b[n] = 2*b[(n - 1)/2] + b[(n + 1)/2]; L[0] = 1; L[n_] := L[n] = b[n - 1] + b[n + 1]; Table[L[n], {n, 1, 200}]
0, 1, 4, 7, 14, 21, 30, 37, 52, 67, 84, 99, 120, 139, 160, 175, 206, 237, 270, 301, 338, 373, 410, 441, 486, 529, 574, 613, 662, 705, 750, 781, 844, 907, 972, 1035, 1104, 1171, 1240, 1303, 1380, 1455, 1532, 1603, 1684, 1759, 1836, 1899, 1992, 2083, 2176, 2263
MATHEMATICA
Table[(n+1)^2 -Sum[Sum[Mod[Binomial[m, k], 2], {k, 0, m}], {m, 0, n}], {n, 0, 60}]
a[0] = 0; a[1] = 1; a[n_] := a[n] = 2 a[Floor[#]] + a[Ceiling[#]] &[n/2]; Array[(# + 1)^2 - a[# + 1] &, 52, 0] (* Michael De Vlieger, Nov 01 2022 *)
PROG
(PARI) {a(n) = (n+1)^2 - sum(m=0, n, sum(k=0, m, binomial(m, k)%2))};
(Magma) [(n+1)^2 - (&+[ (&+[ Binomial(m, k) mod 2: k in [0..m]]): m in [0..n]]): n in [0..60]]; // G. C. Greubel, Apr 11 2019
(Sage) [(n+1)^2 - sum(sum(binomial(m, k)%2 for k in (0..m)) for m in (0..n)) for n in (0..60)] # G. C. Greubel, Apr 11 2019
a(0)=0; for n >= 1, a(n) = f(n) - 2*f(floor((n-1)/2)), where f(n) = A006046(n).
+20
1
0, 1, 3, 3, 7, 5, 9, 9, 17, 11, 15, 15, 23, 19, 27, 27, 43, 29, 33, 33, 41, 37, 45, 45, 61, 49, 57, 57, 73, 65, 81, 81, 113, 83, 87, 87, 95, 91, 99, 99, 115, 103, 111, 111, 127, 119, 135, 135, 167, 139, 147, 147, 163, 155, 171, 171, 203, 179, 195, 195, 227, 211, 243, 243, 307, 245, 249, 249, 257
COMMENTS
For n >= 1, a(n) is the number of ON cells in the n-th generation of the 2-D Mitra-Kumar cellular automaton defined as follows. The state of a cell depends on the states of its NW and NE neighbors at the previous generation.
An ON cell remains ON iff 0 or 2 of its neighbors were ON, and an OFF cell turns ON iff exactly one of its neighbors was ON.
REFERENCES
Sugata Mitra and Sujai Kumar. "Fractal replication in time-manipulated one-dimensional cellular automata." Complex Systems, 16.3 (2006): 191-207. See Fig. 16.
EXAMPLE
The first few generations of the automaton are:
X 0X0 00X00 000X000 0000X0000
X0X 00000 0000000 000000000
X000X 0X000X0 00X000X00
X0X0X0X 000000000
X0000000X
The rows are a subset of the rows of Pascal's triangle A007318 read mod 2 (see A006943). The binary weights of these rows are given by A001316, whose partial sums are A006046, and the formula in the definition follows easily from this.
MAPLE
f:=proc(n) option remember; # A006046
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;
g:=n->f(n)-2*f(floor((n-1)/2));
[0, seq(g(n), n=1..130)];
PROG
(Haskell)
a245550 n = a245550_list !! n
a245550_list = 0 : zipWith (-) (tail a006046_list) (h a006046_list)
where h (x:xs) = (2 * x) : (2 * x) : h xs
Gould's sequence: a(n) = Sum_{k=0..n} (binomial(n,k) mod 2); number of odd entries in row n of Pascal's triangle ( A007318); a(n) = 2^ A000120(n).
(Formerly M0297 N0109)
+10
199
1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 4, 8, 8, 16, 8, 16, 16, 32, 8, 16, 16, 32, 16, 32, 32, 64, 2, 4, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 16, 32, 4, 8, 8, 16, 8, 16, 16, 32
COMMENTS
Also called Dress's sequence.
This sequence might be better called Glaisher's sequence, since James Glaisher showed that odd binomial coefficients are counted by 2^ A000120(n) in 1899. - Eric Rowland, Mar 17 2017 [However, the name "Gould's sequence" is deeply entrenched in the literature. - N. J. A. Sloane, Mar 17 2017] [Named after the American mathematician Henry Wadsworth Gould (b. 1928). - Amiram Eldar, Jun 19 2021]
All terms are powers of 2. The first occurrence of 2^k is at n = 2^k - 1; e.g., the first occurrence of 16 is at n = 15. - Robert G. Wilson v, Dec 06 2000
Also number of 1's in n-th row of triangle in A070886. - Hans Havermann, May 26 2002. Equivalently, number of live cells in generation n of a one-dimensional cellular automaton, Rule 90, starting with a single live cell. - Ben Branman, Feb 28 2009. Ditto for Rule 18. - N. J. A. Sloane, Aug 09 2014. This is also the odd-rule cellular automaton defined by OddRule 003 (see Ekhad-Sloane-Zeilberger "Odd-Rule Cellular Automata on the Square Grid" link). - N. J. A. Sloane, Feb 25 2015
Also number of numbers k, 0<=k<=n, such that (k OR n) = n (bitwise logical OR): a(n) = #{k : T(n,k)=n, 0<=k<=n}, where T is defined as in A080098. - Reinhard Zumkeller, Jan 28 2003
To construct the sequence, start with 1 and use the rule: If k >= 0 and a(0),a(1),...,a(2^k-1) are the first 2^k terms, then the next 2^k terms are 2*a(0),2*a(1),...,2*a(2^k-1). - Benoit Cloitre, Jan 30 2003
Also, numerator((2^k)/k!). - Mohammed Bouayoun (mohammed.bouayoun(AT)sanef.com), Mar 03 2004
The odd entries in Pascal's triangle form the Sierpiński Gasket (a fractal). - Amarnath Murthy, Nov 20 2004
Fixed point of the morphism "1" -> "1,2", "2" -> "2,4", "4" -> "4,8", ..., "2^k" -> "2^k,2^(k+1)", ... starting with a(0) = 1; 1 -> 12 -> 1224 -> = 12242448 -> 122424482448488(16) -> ... . - Philippe Deléham, Jun 18 2005
a(n) = number of 1's of stage n of the one-dimensional cellular automaton with Rule 90. - Andras Erszegi (erszegi.andras(AT)chello.hu), Apr 01 2006
For positive n, a(n) equals the denominator of the permanent of the n X n matrix consisting entirely of (1/2)'s. - John M. Campbell, May 26 2011
This is the Run Length Transform of S(n) = {1,2,4,8,16,...} (cf. A000079). The Run Length Transform of a sequence {S(n), n>=0} is defined to be the sequence {T(n), n>=0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g., 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0)=1 (the empty product). - N. J. A. Sloane, Sep 05 2014
A production matrix for the sequence is lim_{k->infinity} M^k, the left-shifted vector of M:
1, 0, 0, 0, 0, ...
2, 0, 0, 0, 0, ...
0, 1, 0, 0, 0, ...
0, 2, 0, 0, 0, ...
0, 0, 1, 0, 0, ...
0, 0, 2, 0, 0, ...
0, 0, 0, 1, 0, ...
...
The result is equivalent to the g.f. of Apr 06 2003: Product_{k>=0} (1 + 2*z^(2^k)). (End)
Number of binary palindromes of length n for which the first floor(n/2) symbols are themselves a palindrome (Ji and Wilf 2008). - Jeffrey Shallit, Jun 15 2017
REFERENCES
Arthur T. Benjamin and Jennifer J. Quinn, Proofs that really count: the art of combinatorial proof, M.A.A., 2003, p. 75ff.
Steven R. Finch, Mathematical Constants, Cambridge, 2003, pp. 145-151.
James W. L. Glaisher, On the residue of a binomial-theorem coefficient with respect to a prime modulus, Quarterly Journal of Pure and Applied Mathematics, Vol. 30 (1899), pp. 150-156.
H. W. Gould, Exponential Binomial Coefficient Series. Tech. Rep. 4, Math. Dept., West Virginia Univ., Morgantown, WV, Sep 1961.
Olivier Martin, Andrew M. Odlyzko, and Stephen Wolfram, Algebraic properties of cellular automata, Comm. Math. Physics, Vol. 93 (1984), pp. 219-258. Reprinted in Theory and Applications of Cellular Automata, S Wolfram, Ed., World Scientific, 1986, pp. 51-90 and in Cellular Automata and Complexity: Collected Papers of Stephen Wolfram, Addison-Wesley, 1994, pp. 71-113
Manfred R. Schroeder, Fractals, Chaos, Power Laws, W. H. Freeman, NY, 1991, page 383.
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).
Andrew Wuensche, Exploring Discrete Dynamics, Luniver Press, 2011. See Fig. 2.3.
LINKS
Neil J. Calkin, Eunice Y. S. Chan, Robert M. Corless, David J. Jeffrey, and Piers W. Lawrence, A Fractal Eigenvector, arXiv:2104.01116 [math.DS], 2021.
Kathy Q. Ji and Herbert S. Wilf, Extreme Palindromes, Amer. Math. Monthly, Vol. 115, No. 5 (2008), pp. 447-451.
Sam Northshield, Stern's Diatomic Sequence 0,1,1,2,1,3,2,3,1,4,..., Amer. Math. Month., Vol. 117, No. 7 (2010), pp. 581-598.
FORMULA
a(0) = 1; for n > 0, write n = 2^i + j where 0 <= j < 2^i; then a(n) = 2*a(j).
G.f.: Product_{k>=0} (1+2*z^(2^k)). - Ralf Stephan, Apr 06 2003
a(n) = Sum_{i=0..2*n} (binomial(2*n, i) mod 2)*(-1)^i. - Benoit Cloitre, Nov 16 2003
a(n) = 2^n - 2*Sum_{k=0..n} floor(binomial(n, k)/2). - Paul Barry, Dec 24 2004
a(n) = Product_{k=0..log_2(n)} 2^b(n, k), b(n, k) = coefficient of 2^k in binary expansion of n. - Paul D. Hanna
a(n) = n/2 + 1/2 + (1/2)*Sum_{k=0..n} (-(-1)^binomial(n,k)). - Stephen Crowley, Mar 21 2007
Equals infinite convolution product of [1,2,0,0,0,0,0,0,0] aerated ( A000079 - 1) times, i.e., [1,2,0,0,0,0,0,0,0] * [1,0,2,0,0,0,0,0,0] * [1,0,0,0,2,0,0,0,0]. - Mats Granvik, Gary W. Adamson, Oct 02 2009
a(n) = f(n, 1) with f(x, y) = if x = 0 then y otherwise f(floor(x/2), y*(1 + x mod 2)). - Reinhard Zumkeller, Nov 21 2009
EXAMPLE
Has a natural structure as a triangle:
.1,
.2,
.2,4,
.2,4,4,8,
.2,4,4,8,4,8,8,16,
.2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,
.2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32,64,
....
Also, triangle begins:
.1;
.2,2;
.4,2,4,4;
.8,2,4,4,8,4,8,8;
16,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16;
32,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32;
64,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,...
(End)
G.f. = 1 + 2*x + 2*x^2 + 4*x^3 + 2*x^4 + 4*x^5 + 4*x^6 + 8*x^7 + 2*x^8 + ...
MAPLE
A001316 := proc(n) local k; add(binomial(n, k) mod 2, k=0..n); end;
S:=[1]; S:=[op(S), op(2*s)]; # repeat ad infinitum!
a := n -> 2^add(i, i=convert(n, base, 2)); # Peter Luschny, Mar 11 2009
MATHEMATICA
Table[ Sum[ Mod[ Binomial[n, k], 2], {k, 0, n} ], {n, 0, 100} ]
Nest[ Join[#, 2#] &, {1}, 7] (* Robert G. Wilson v, Jan 24 2006 and modified Jul 27 2014 *)
Map[Function[Apply[Plus, Flatten[ #1]]], CellularAutomaton[90, {{1}, 0}, 100]] (* Produces counts of ON cells. N. J. A. Sloane, Aug 10 2009 *)
ArrayPlot[CellularAutomaton[90, {{1}, 0}, 20]] (* Illustration of first 20 generations. - N. J. A. Sloane, Aug 14 2014 *)
Table[2^(RealDigits[n - 1, 2][[1]] // Total), {n, 1, 100}] (* Gabriel C. Benamy, Dec 08 2009 *)
Count[#, _?OddQ]&/@Table[Binomial[n, k], {n, 0, 90}, {k, 0, n}] (* Harvey P. Dale, Sep 22 2015 *)
PROG
(PARI) {a(n) = if( n<0, 0, numerator(2^n / n!))};
(Haskell)
import Data.List (transpose)
a001316_list = 1 : zs where
zs = 2 : (concat $ transpose [zs, map (* 2) zs])
(Sage, Python)
from functools import cache
@cache
if n <= 1: return n+1
(Python)
(Scheme) (define ( A001316 n) (let loop ((n n) (z 1)) (cond ((zero? n) z) ((even? n) (loop (/ n 2) z)) (else (loop (/ (- n 1) 2) (* z 2)))))) ;; Antti Karttunen, May 29 2017
CROSSREFS
For generating functions Product_{k>=0} (1+a*x^(b^k)) for the following values of (a,b) see: (1,2) A000012 and A000027, (1,3) A039966 and A005836, (1,4) A151666 and A000695, (1,5) A151667 and A033042, (2,2) A001316, (2,3) A151668, (2,4) A151669, (2,5) A151670, (3,2) A048883, (3,3) A117940, (3,4) A151665, (3,5) A151671, (4,2) A102376, (4,3) A151672, (4,4) A151673, (4,5) A151674.
This is the numerator of 2^n/n!, while A049606 gives the denominator.
Cf. A051638, A048967, A007318, A094959, A048896, A117973, A008977, A139541, A048883, A102376, A038573, A159913, A000079, A166548, A006047, A089898, A105321, A061142.
If we subtract 1 from the terms we get a pair of essentially identical sequences, A038573 and A159913.
Number of "ON" cells at n-th stage in the "Ulam-Warburton" two-dimensional cellular automaton.
+10
91
0, 1, 5, 9, 21, 25, 37, 49, 85, 89, 101, 113, 149, 161, 197, 233, 341, 345, 357, 369, 405, 417, 453, 489, 597, 609, 645, 681, 789, 825, 933, 1041, 1365, 1369, 1381, 1393, 1429, 1441, 1477, 1513, 1621, 1633, 1669, 1705, 1813, 1849, 1957, 2065, 2389, 2401, 2437, 2473
COMMENTS
Studied by Holladay and Ulam circa 1960. See Fig. 1 and Example 1 of the Ulam reference. - N. J. A. Sloane, Aug 02 2009.
Singmaster calls this the Ulam-Warburton cellular automaton. - N. J. A. Sloane, Aug 05 2009
On the infinite square grid, start with all cells OFF.
Turn a single cell to the ON state.
At each subsequent step, each cell with exactly one neighbor ON is turned ON, and everything that is already ON remains ON.
Here "neighbor" refers to the four adjacent cells in the X and Y directions.
Note that "neighbor" could equally well refer to the four adjacent cells in the diagonal directions, since the graph formed by Z^2 with "one-step rook" adjacencies is isomorphic to Z^2 with "one-step bishop" adjacencies.
Also toothpick sequence starting with a central X-toothpick followed by T-toothpicks (see A160170 and A160172). The sequence gives the number of polytoothpicks in the structure after n-th stage. - Omar E. Pol, Mar 28 2011
It appears that this sequence shares infinitely many terms with both A162795 and A169707, see Formula section and Example section. - Omar E. Pol, Feb 20 2015
It appears that the positive terms are also the odd terms (a bisection) of A151920. - Omar E. Pol, Mar 06 2015
Also, the number of active (ON, black) cells in the n-th stage of growth of two-dimensional cellular automaton defined by Wolfram's "Rule 558" or "Rule 686" based on the 5-celled von Neumann neighborhood. - Robert Price, May 10 2016
a(n) is also the total number of "hidden crosses" after 4*n stages in the toothpick structure of A139250, including the central cross, beginning to count the crosses when their nuclei are totally formed with 4 quadrilaterals.
a(n) is also the total number of "flowers with six petals" after 4*n stages in the toothpick structure of A323650.
Note that the location of the "nuclei of the hidden crosses" and the "flowers with six petals" in both toothpick structures is essentially the same as the location of the "ON" cells in the version "one-step bishop" of this sequence (see the illustration of initial terms, figure 2). (End)
REFERENCES
S. Ulam, On some mathematical problems connected with patterns of growth of figures, pp. 215-224 of R. E. Bellman, ed., Mathematical Problems in the Biological Sciences, Proc. Sympos. Applied Math., Vol. 14, Amer. Math. Soc., 1962.
S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 928.
FORMULA
a(n) = 1 + 4*Sum_{k=1..n-1} 3^(wt(k)-1) for n>1, where wt() = A000120(). [Corrected by Paolo Xausa, Aug 12 2022]
a(n) = 2* A151917(n) - 1, for n >= 1.
a(n) = 1 + 4* A151920(n-2), for n >= 2.
(End)
EXAMPLE
If we label the generations of cells turned ON by consecutive numbers we get a rosetta cell pattern:
. . . . . . . . . . . . . . . . .
. . . . . . . . 4 . . . . . . . .
. . . . . . . 4 3 4 . . . . . . .
. . . . . . 4 . 2 . 4 . . . . . .
. . . . . 4 3 2 1 2 3 4 . . . . .
. . . . . . 4 . 2 . 4 . . . . . .
. . . . . . . 4 3 4 . . . . . . .
. . . . . . . . 4 . . . . . . . .
. . . . . . . . . . . . . . . . .
In the first generation, only the central "1" is ON, a(1)=1. In the next generation, we turn ON four "2", leading to a(2)=a(1)+4=5. In the third generation, four "3" are turned ON, a(3)=a(2)+4=9. In the fourth generation, each of the four wings allows three 4's to be turned ON, a(4)=a(3)+4*3=21.
Also, written as an irregular triangle T(j,k), j>=0, k>=1, in which the row lengths are the terms of A011782:
1;
5;
9, 21;
25, 37, 49, 85;
89, 101,113,149,161,197,233,341;
345,357,369,405,417,453,489,597,609,645,681,789,825,933,1041,1365;
...
The right border gives the positive terms of A002450.
(End)
It appears that T(j,k) = A162795(j,k) = A169707(j,k), if k is a power of 2, for example: it appears that the three mentioned triangles only share the elements from the columns 1, 2, 4, 8, 16, ... - Omar E. Pol, Feb 20 2015
MAPLE
Since this is the partial sum sequence of A147582, it is most easily obtained using the Maple code given in A147582.
# [x, y] coordinates of cells on
Lse := [[0, 0]] ;
# enclosing rectangle of the cells on (that is, minima and maxima in Lse)
xmin := 0 ;
xmax := 0 ;
ymin := 0 ;
ymax := 0 ;
# count neighbors of x, y which are on; return 0 if [x, y] is in L
cntnei := proc(x, y, L)
local a, p, xpt, ypt;
a := 0 ;
if not [x, y] in L then
for p in Lse do
xpt := op(1, p) ;
ypt := op(2, p) ;
if ( abs(xpt-x) = 1 and ypt=y ) or ( x=xpt and abs(ypt-y) = 1) then
a := a+1 ;
fi;
od:
fi:
RETURN(a) ;
end:
# loop over generations/steps
for stp from 1 to 10 do
Lnew := [] ;
for x from xmin-1 to xmax+1 do
for y from ymin-1 to ymax+1 do
if cntnei(x, y, Lse) = 1 then
Lnew := [op(Lnew), [x, y]] ;
fi;
od:
od:
for p in Lnew do
xpt := op(1, p) ;
ypt := op(2, p) ;
xmin := min(xmin, xpt) ;
xmax := max(xmax, xpt) ;
ymin := min(ymin, ypt) ;
ymax := max(ymax, ypt) ;
od:
Lse := [op(Lse), op(Lnew)] ;
print(nops(Lse)) ;
MATHEMATICA
Join[{0}, Map[Function[Apply[Plus, Flatten[ #1]]], CellularAutomaton[{686, {2, {{0, 2, 0}, {2, 1, 2}, {0, 2, 0}}}, {1, 1}}, {{{1}}, 0}, 200]]] (* Nadia Heninger and N. J. A. Sloane, Aug 11 2009; modified by Paolo Xausa, Aug 12 2022 to include the a(0) term *)
ArrayPlot /@ CellularAutomaton[{686, {2, {{0, 2, 0}, {2, 1, 2}, {0, 2, 0}}}, {1, 1}}, {{{1}}, 0}, 16] (* N. J. A. Sloane, Nov 08 2014 *)
A147562list[nmax_]:=Accumulate[Join[{0, 1}, 4*3^(DigitCount[Range[nmax-1], 2, 1]-1)]]; A147562list[100] (* Paolo Xausa, May 21 2023 *)
PROG
(PARI) a(n) = if (n, 1 + 4*sum(k=1, n-1, 3^(hammingweight(k)-1)), 0); \\ Michel Marcus, Jul 05 2022
CROSSREFS
Cf. A000120, A139250, A147582 (number turned ON at n-th step), A147610, A130665, A151920, A151917, A160120, A160164, A160410, A160414, A162795, A169707, A187220, A246331, A323650.
EXTENSIONS
Numbers in the comment adapted to the offset by R. J. Mathar, Mar 03 2010
Number of entries in n-th row of Pascal's triangle not divisible by 3.
(Formerly M0422)
+10
29
1, 2, 3, 2, 4, 6, 3, 6, 9, 2, 4, 6, 4, 8, 12, 6, 12, 18, 3, 6, 9, 6, 12, 18, 9, 18, 27, 2, 4, 6, 4, 8, 12, 6, 12, 18, 4, 8, 12, 8, 16, 24, 12, 24, 36, 6, 12, 18, 12, 24, 36, 18, 36, 54, 3, 6, 9, 6, 12, 18, 9, 18, 27, 6, 12, 18, 12, 24, 36, 18, 36, 54, 9, 18, 27, 18, 36, 54, 27, 54
COMMENTS
Fixed point of the morphism a -> a, 2a, 3a, starting from a(1) = 1. - Robert G. Wilson v, Jan 24 2006
This is a particular case of the number of entries in n-th row of Pascal's triangle not divisible by a prime p, which is given by a simple recursion using ⊗, the Kronecker (or tensor) product of vectors. Let v_0=(1,2,...,p). Then v_{n+1}=v_0 ⊗ v_n, where the vector v_n contains the values for the first p^n rows of Pascal's triangle (rows 0 through p^n-1). - William B. Everett (bill(AT)chgnet.ru), Mar 29 2008
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
FORMULA
Write n in base 3; if the representation contains r 1's and s 2's then a(n) = 3^s * 2^r. Also a(n) = Sum_{k=0..n} (C(n, k)^2 mod 3). - Avi Peretz (njk(AT)netvision.net.il), Apr 21 2001
a(n) = b(n+1), with b(1)=1, b(2)=2, b(3n)=3b(n), b(3n+1)=b(n+1), b(3n+2)=2b(n+1). - Ralf Stephan, Sep 15 2003
G.f.: Product_{n>=0} (1+2*x^(3^n)+3*x^(2*3^n)) (Northshield). - Johannes W. Meijer, Jun 05 2011
G.f. g(x) satisfies g(x) = (1 + 2*x + 3*x^2)*g(x^3). - Robert Israel, Oct 15 2015
a(3^k) = 2 for k>=0;
a(2*3^k) = 3 for k>=0;
a(n) = Product_{b_j != 0} a(b_j*3^j) where n = Sum_{j>=0} b_j*3^j is the ternary representation of n. (End)
a(n) = Sum_{k = 0..n} mod(C(n,k)^2, 3). - Peter Bala, Dec 17 2020
EXAMPLE
15 in base 3 is 120, here r=1 and s=1 so a(15) = 3*2 = 6.
William B. Everett's comment with p=3, n=2: v_0 = (1,2,3), v_1 = (1,2,3) => v_2 = (1*1,1*2,1*3,2*1,2*2,2*3,3*1,3*2,3*3) = (1,2,3,2,4,6,3,6,9), the first 3^2 values of the present sequence. - Wolfdieter Lang, Mar 19 2014
MAPLE
p:=proc(n) local ct, k: ct:=0: for k from 0 to n do if binomial(n, k) mod 3 = 0 then else ct:=ct+1 fi od: end: seq(p(n), n=0..82); # Emeric Deutsch
f:= proc(n) option remember; ((n mod 3)+1)*procname(ceil((n+1)/3)-1) end proc:
f(0):= 1: f(1):= 2:
MATHEMATICA
Nest[Flatten[ # /. a_Integer -> {a, 2a, 3a}] &, {1}, 4] (* Robert G. Wilson v, Jan 24 2006 *)
PROG
(PARI) b(n)=if(n<3, n, if(n%3==0, 3*b(n/3), if(n%3==1, 1*b((n+2)/3), 2*b((n+1)/3)))) \\ Ralf Stephan
(PARI) A006047(n) = b(1+n); \\ (The above PARI-program by Ralf Stephan is for offset-1-version of this sequence.) - Antti Karttunen, May 28 2017
(PARI) A006047(n) = { my(m=1, d); while(n, d = (n%3); m *= (1+d); n \= 3); m; }; \\ Antti Karttunen, May 28 2017
(PARI) a(n) = prod(i=1, #d=digits(n, 3), (1+d[i])) \\ David A. Corneth, May 28 2017
(PARI) upto(n) = my(res = [1], v); while(#res < n, v = concat(2*res, 3*res); res = concat(res, v)); res \\ David A. Corneth, May 29 2017
(Haskell)
a006047 = sum . map signum . a083093_row
(Scheme) (define ( A006047 n) (if (zero? n) 1 (let ((d (mod n 3))) (* (+ 1 d) ( A006047 (/ (- n d) 3)))))) ;; For R6RS standard. Use modulo instead of mod in older Schemes like MIT/GNU Scheme. - Antti Karttunen, May 28 2017
(Python)
from sympy.ntheory.factor_ import digits
from sympy import prod
def a(n):
d=digits(n, 3)
return n + 1 if n<3 else prod(1 + d[i] for i in range(1, len(d)))
CROSSREFS
Cf. A001316, A003586, A038148, A053735, A083093, A089898, A206424, A227428, A286586, A286587, A286633.
Search completed in 0.043 seconds
|