A087120 Smallest numbers having in binary representation exactly n maximal groups of consecutive zeros.
1, 0, 10, 42, 170, 682, 2730, 10922, 43690, 174762, 699050, 2796202, 11184810, 44739242, 178956970, 715827882, 2863311530, 11453246122, 45812984490, 183251937962, 733007751850, 2932031007402, 11728124029610, 46912496118442
Offset: 0
Keywords
A184908 Let S_n be the set of the integers having alternating bit sum equal to -n. There are a(n) primes among the smallest 3n+5 odd numbers of S_n.
1, 7, 5, 0, 7, 5, 0, 7, 10, 0, 6, 3, 0, 5, 9, 0, 7, 7, 0, 7, 9, 0, 5, 6, 0, 6, 7, 0, 10, 7, 0, 4, 5, 0, 11, 7, 0, 10, 9, 0, 9, 4, 0, 4, 8, 0, 2, 6, 0, 9, 5, 0, 10, 9, 0, 8, 6, 0, 4, 3, 0, 4, 11, 0, 9, 3, 0, 5, 8, 0, 6, 3, 0, 11, 7, 0, 6, 8, 0, 5, 6
Offset: 0
Examples
The smallest 3n+5 = 8 odd numbers of the set S_1 of the integers having alternating bit sum -1 are 11, 35, 41, 47, 59, 107, 131, and 137, so a(1)=7.
Programs
-
Maple
A065359 := proc(n) local dgs ; dgs := convert(n,base,2) ; add( -op(i,dgs)*(-1)^i,i=1..nops(dgs)) ; end proc: S := proc(n) local ads,k; ads := {} ; for k from 1 by 2 do if A065359(k) = -n then ads := ads union {k} ; end if; if nops(ads) = 3*n+5 then return ads; end if; end do: end proc: A184908 := proc(n) local ads,a,p; a := 0 ; for p in S(n) do if isprime(p) then a := a+1 ; end if; end do: a ; end proc: for n from 0 do print(A184908(n)); end do: # slow! R. J. Mathar, Feb 11 2011
-
PARI
II()={i = (2/3)*(4^n-1) + 1 + 2^(2*n+1); if(isprime(i),an++)}; III()={w = 2^(2*n+3); for(j=1, n+1, i += w; w /= 4; i -= w; if(isprime(i), an++ ))}; IV()={i+=6; if(isprime(i), an++ ); w=4; for(j=1, n, i -= w; w *= 4; i += w; if(isprime(i), an++))}; V()={i += 2^(2*n+4) - 2^(2*n+2); if(isprime(i),an++ );w = i + 2^(2*n+5) - 2^(2*n+4); i = w - 2^(2*n+3) - 2^(2*n+1); if(isprime(i),an++ );w = 2^(2*n+1);for(j=1, n,i += w; w /= 4; i -= w;if(isprime(i),an++ ))}; print1("1, 7, ");for(n=2,80, an=0; II(); III(); IV(); V(); print1(an,", ")) \\ Washington Bomfim, Feb 06 2011
A216649 Triangle T(n,k) in which n-th row lists in increasing order all positive integers with a representation as totally balanced 2n digit binary string such that all consecutive totally balanced substrings are in nondecreasing order; n>=1, 1<=k<=A000081(n+1).
2, 10, 12, 42, 44, 52, 56, 170, 172, 180, 184, 204, 212, 216, 232, 240, 682, 684, 692, 696, 716, 724, 728, 744, 752, 820, 824, 852, 856, 872, 880, 920, 936, 944, 976, 992, 2730, 2732, 2740, 2744, 2764, 2772, 2776, 2792, 2800, 2868, 2872, 2900, 2904, 2920, 2928
Offset: 1
Comments
There is a simple bijection between the elements of row n and the rooted trees with n+1 nodes. The tree has a root node. Each matching pair (1,0) in the binary string representation encodes an additional node, the totally balanced substrings encode lists of subtrees.
Examples
172 is element of row 4, the binary string representation (with totally balanced substrings enclosed in parentheses) is (10)(10)(1(10)0). The encoded rooted tree is: . o . /|\ . o o o . | . o Triangle T(n,k) begins: 2; 10, 12; 42, 44, 52, 56; 170, 172, 180, 184, 204, 212, 216, 232, 240; 682, 684, 692, 696, 716, 724, 728, 744, 752, 820, 824, ... 2730, 2732, 2740, 2744, 2764, 2772, 2776, 2792, 2800, 2868, 2872, ... Triangle T(n,k) in binary: 10; 1010, 1100; 101010, 101100, 110100, 111000; 10101010, 10101100, 10110100, 10111000, 11001100, 11010100, ... 1010101010, 1010101100, 1010110100, 1010111000, 1011001100, 1011010100, ...
Links
- Alois P. Heinz, Rows n = 1..11, flattened
Crossrefs
Programs
-
Maple
F:= proc(n) option remember; `if`(n=1, [10], sort(map(h-> parse(cat(1, sort(h)[], 0)), g(n-1, n-1)))) end: g:= proc(n, i) option remember; `if`(i=1, [[10$n]], [seq(seq(seq( [seq (F(i)[w[t]-t+1], t=1..j),v[]], w=combinat[choose]( [$1..nops(F(i))+j-1], j)), v=g(n-i*j, i-1)), j=0..n/i)]) end: b:= proc(n) local h, i, r; h, r:= n/10, 0; for i from 0 while h>1 do r:= r+2^i*irem(h, 10, 'h') od; r end: T:= proc(n) option remember; map(b, F(n+1))[] end: seq(T(n), n=1..6);
Formula
T(n,k) = A216648(n+1,k)/2 - 2^(2*n).
A263133 Numbers m such that binomial(4*m + 3, m) is odd.
0, 1, 2, 3, 5, 7, 10, 11, 15, 21, 23, 31, 42, 43, 47, 63, 85, 87, 95, 127, 170, 171, 175, 191, 255, 341, 343, 351, 383, 511, 682, 683, 687, 703, 767, 1023, 1365, 1367, 1375, 1407, 1535, 2047, 2730, 2731, 2735, 2751, 2815, 3071, 4095, 5461, 5463, 5471, 5503
Offset: 1
Comments
The even terms in the sequence are A020988. If m is a term in the sequence then 2*m + 1 is also a term in the sequence. Repeatedly applying the transformation m -> 2*m + 1 to the terms of A020988 produces all the terms of this sequence. See the example below.
2*a(n) gives the values of m such that binomial(4*m + 6, m) is odd.
Examples
1) This sequence can be read from Table 1 below in a sequence of 'knight moves' (2 down and 1 to the left) starting from the first two rows. For example, starting at 42 in the first row we jump 42 -> 43 -> 47 -> 63, then return to the second row at 85 and jump 85 -> 87 -> 95 -> 127, followed by 170 -> 171 -> 175 -> 191 -> 255, and so on. ........................................................... . Table 1. 2^n*ceiling((2^(2*k + 1) - 1)/3) - 1, n,k >= 0 . ........................................................... n\k| 0 1 2 3 4 5 ---+--------------------------------- 0 | 0 2 10 42 170 682 ... 1 | 1 5 21 85 341 ... 2 | 3 11 43 171 683 ... 3 | 7 23 87 343 ... 4 | 15 47 175 687 ... 5 | 31 95 351 ... 6 | 63 191 703 ... 7 | 127 383 ... 8 | 255 767 ... 9 | 511 ... ... The first row of the table is A020988. The columns of the table are obtained by repeatedly applying the transformation m -> 2*m + 1 to the entries in the first row. 2) Alternatively, this sequence can be read from Table 2 below by starting with a number on the top row and moving in a series of 'knight moves' (1 down and 2 to the left) through the table as far as you can, before returning to the next number in the top row and repeating the process. For example, starting at 10 in the first row we move 10 -> 11 -> 15, then return to the top row at 21 and move 21 -> 23 -> 31, before returning to the top row at 42 and so on. ........................................................ . Table 2. (4^n)*ceiling(2^k/3) - 1 for n >= 0, k >= 1 . ........................................................ n\k| 1 2 3 4 5 6 7 8 9 10 ---+--------------------------------------------------------- 0| 0 1 2 5 10 21 42 85 170 682... 1| 3 7 11 23 43 87 171 343 683 ... 2| 15 31 47 95 175 351 687 1375 ... 3| 63 127 191 383 703 1407 2751 5503 ... 4| 255 511 767 1535 2815 5631 11007 22015 ... 5| 1023 2047 3071 6143 11263 22527 44031 88063 ... 6| 4095 ... ... The first row of the table is A000975. The columns of the table are obtained by repeatedly applying the transformation m -> 4*m + 3 to the entries in the first row.
Crossrefs
Programs
-
Magma
[n: n in [0..6000] | Binomial(4*n+3, n) mod 2 eq 1]; // Vincenzo Librandi, Oct 12 2015
-
Maple
for n from 1 to 4096 do if mod(binomial(4*n+3, n), 2) = 1 then print(n) end if end do;
-
Mathematica
Select[Range[0,5600],OddQ[Binomial[4#+3,#]]&] (* Harvey P. Dale, Apr 15 2019 *)
-
PARI
for(n=0, 1e4, if (binomial(4*n+3, n) % 2 == 1, print1(n", "))) \\ Altug Alkan, Oct 11 2015
-
PARI
a(n) = my(r,s=sqrtint(4*n-3,&r)); (1<
Kevin Ryde, Jul 06 2025 -
Python
A263133_list = [m for m in range(10**6) if not ~(4*m+3) & m] # Chai Wah Wu, Feb 07 2016
Formula
a(n) = A263132(n) - 1.
m is a term if and only if m AND NOT (4*m+3) = 0 where AND and NOT are bitwise operators. - Chai Wah Wu, Feb 07 2016
Extensions
More terms from Vincenzo Librandi, Oct 12 2015
A266753 Decimal representation of the n-th iteration of the "Rule 163" elementary cellular automaton starting with a single ON (black) cell.
1, 4, 18, 74, 298, 1194, 4778, 19114, 76458, 305834, 1223338, 4893354, 19573418, 78293674, 313174698, 1252698794, 5010795178, 20043180714, 80172722858, 320690891434, 1282763565738, 5131054262954, 20524217051818, 82096868207274, 328387472829098
Offset: 0
References
- S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 55.
Links
- Robert Price, Table of n, a(n) for n = 0..1000
- Eric Weisstein's World of Mathematics, Elementary Cellular Automaton
- S. Wolfram, A New Kind of Science
- Index entries for sequences related to cellular automata
- Index to Elementary Cellular Automata
Programs
-
Mathematica
rule=163; rows=20; ca=CellularAutomaton[rule,{{1},0},rows-1,{All,All}]; (* Start with single black cell *) catri=Table[Take[ca[[k]],{rows-k+1,rows+k-1}],{k,1,rows}]; (* Truncated list of each row *) Table[FromDigits[catri[[k]],2],{k,1,rows}] (* Decimal Representation of Rows *)
Formula
Conjectures from Colin Barker, Jan 20 2016 and Apr 20 2019: (Start)
a(n) = 5*a(n-1)-4*a(n-2) for n>2.
G.f.: (1-x+2*x^2) / ((1-x)*(1-4*x)).
(End)
Empirical a(n) = (7*4^n - 4)/6 for n>1. - Colin Barker, Nov 25 2016 and Apr 20 2019
a(n) = 4*a(n-1) + 2, n>1, conjectured. - Yosu Yurramendi, Jan 22 2017
a(n) = 2*A020988(n) - A020988(n-1) = A020988(n) + 2^(2n-1) for n > 0, conjectured. - Yosu Yurramendi, Jan 24 2017 [n range correction - Karl V. Keller, Jr., May 07 2022]
Extensions
Removed an unjustified claim that Colin Barker's conjectures are correct. Removed a program based on a conjecture. - N. J. A. Sloane, Jun 13 2022
A342700 For any number n with binary expansion (b(1), b(2), ..., b(k)), the binary expansion of a(n) is (1-floor((b(k)+b(1)+b(2))/2), 1-floor((b(1)+b(2)+b(3))/2), ..., 1-floor((b(k-1)+b(k)+b(1))/2)).
0, 0, 2, 0, 7, 0, 0, 0, 15, 6, 10, 0, 3, 0, 0, 0, 31, 14, 30, 12, 23, 4, 16, 0, 7, 6, 2, 0, 3, 0, 0, 0, 63, 30, 62, 28, 63, 28, 56, 24, 47, 14, 42, 8, 35, 0, 32, 0, 15, 14, 14, 12, 7, 4, 0, 0, 7, 6, 2, 0, 3, 0, 0, 0, 127, 62, 126, 60, 127, 60, 120, 56, 127, 62
Offset: 0
Comments
This sequence is a variant of A342698; here the value of the k-th bit of a(n) is the less frequent value in the bit triple centered around the k-th bit of n.
Examples
The first terms, in decimal and in binary, are: n a(n) bin(n) bin(a(n)) -- ---- ------ --------- 0 0 0 0 1 0 1 0 2 2 10 10 3 0 11 0 4 7 100 111 5 0 101 0 6 0 110 0 7 0 111 0 8 15 1000 1111 9 6 1001 110 10 10 1010 1010 11 0 1011 0 12 3 1100 11 13 0 1101 0 14 0 1110 0 15 0 1111 0
Links
Programs
-
PARI
a(n) = my (w=#binary(n)); sum(k=0, w-1, ((bittest(n, (k-1)%w)+bittest(n, k%w)+bittest(n, (k+1)%w))<=1) * 2^k)
A125725 Numbers whose base-7 representation is 222....2.
0, 2, 16, 114, 800, 5602, 39216, 274514, 1921600, 13451202, 94158416, 659108914, 4613762400, 32296336802, 226074357616, 1582520503314, 11077643523200, 77543504662402, 542804532636816, 3799631728457714, 26597422099204000
Offset: 1
Examples
base 7.......decimal 0..................0 2..................2 22................16 222..............114 2222.............800 22222...........5602 222222.........39216 2222222.......274514 22222222.....1921600 222222222...13451202 etc...........etc.
Links
- Davis Smith, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (8,-7).
Crossrefs
Programs
-
GAP
List([1..25], n-> (7^(n-1) -1)/3); # G. C. Greubel, May 23 2019
-
Magma
[0] cat [n:n in [1..15000000]| Set(Intseq(n,7)) subset [2]]; // Marius A. Burtea, May 06 2019
-
Magma
[(7^(n-1)-1)/3: n in [1..25]]; // Marius A. Burtea, May 06 2019
-
Maple
seq(2*(7^n-1)/6, n=0..25);
-
Mathematica
FromDigits[#,7]&/@Table[PadLeft[{2},n,2],{n,0,25}] (* Harvey P. Dale, Apr 13 2011 *) (7^(Range[25]-1) - 1)/3 (* G. C. Greubel, May 23 2019 *)
-
PARI
vector(25, n, (7^(n-1)-1)/3) \\ Davis Smith, Apr 04 2019
-
Sage
[(7^(n-1) -1)/3 for n in (1..25)] # G. C. Greubel, May 23 2019
Formula
a(n) = (7^(n-1) - 1)/3 = 2*A023000(n-1).
a(n) = 7*a(n-1) + 2, with a(1)=0. - Vincenzo Librandi, Sep 30 2010
G.f.: 2*x^2 / ( (1-x)*(1-7*x) ). - R. J. Mathar, Sep 30 2013
From Davis Smith, Apr 04 2019: (Start)
A007310(a(n) + 1) = 7^(n - 1).
E.g.f.: (exp(7*x) - 7*exp(x) + 6)/21. - Stefano Spezia, Jan 12 2025
Extensions
Offset corrected by N. J. A. Sloane, Oct 02 2010
A193579 a(n) = 2*4^n + 7.
9, 15, 39, 135, 519, 2055, 8199, 32775, 131079, 524295, 2097159, 8388615, 33554439, 134217735, 536870919, 2147483655, 8589934599, 34359738375, 137438953479, 549755813895, 2199023255559, 8796093022215, 35184372088839, 140737488355335, 562949953421319, 2251799813685255
Offset: 0
Comments
Bisection of A168415 (odd part).
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (5,-4).
Programs
-
Magma
[2*4^n + 7: n in [0..30]]; // Vincenzo Librandi, Sep 30 2011
-
Mathematica
2*4^Range[0,30]+7 (* or *) LinearRecurrence[{5,-4},{9,15},30] (* Harvey P. Dale, Jun 13 2020 *)
-
PARI
a(n) = 2*4^n+7 \\ Felix Fröhlich, Nov 07 2018
-
PARI
Vec(3*(3 - 10*x)/((1 - x)*(1 - 4*x)) + O(x^20)) \\ Felix Fröhlich, Nov 07 2018
Formula
a(n) = 2^(2n + 1) + 7 = 3*(A020988(n) + 3).
From Bruno Berselli, Sep 20 2011: (Start)
G.f.: 3*(3 - 10*x)/((1 - x)*(1 - 4*x)).
E.g.f.: 7*exp(x) + 2*exp(4*x). - Franck Maminirina Ramaharo, Nov 07 2018
A295521 a(n) = (1/n) * Sum_{d|n} mu(n/d)*(4^d - 3^d - 2^d + 1).
0, 2, 10, 39, 150, 545, 2010, 7320, 26880, 98775, 365010, 1353185, 5038950, 18830145, 70623958, 265737270, 1002976350, 3796197160, 14406059010, 54801140307, 208932573650, 798218035245, 3055417070010, 11716354754030, 45002103387120, 173117601112575
Offset: 1
Keywords
Links
- Seiichi Manyama, Table of n, a(n) for n = 1..1666
- Wikipedia, Möbius function
Programs
-
Mathematica
a[n_] := DivisorSum[n, MoebiusMu[n/#] * (4^# - 3^# - 2^# + 1) &] / n; Array[a, 26] (* Amiram Eldar, Oct 04 2023 *)
-
PARI
{a(n) = sumdiv(n, d, moebius(n/d)*(4^d-3^d-2^d+1))/n}
A321358 a(n) = (2*4^n + 7)/3.
3, 5, 13, 45, 173, 685, 2733, 10925, 43693, 174765, 699053, 2796205, 11184813, 44739245, 178956973, 715827885, 2863311533, 11453246125, 45812984493, 183251937965, 733007751853, 2932031007405, 11728124029613, 46912496118445, 187649984473773, 750599937895085, 3002399751580333
Offset: 0
Comments
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (5,-4).
Programs
-
Mathematica
a[n_]:= (2*4^n + 7)/3; Array[a, 20, 0] (* or *) CoefficientList[Series[1/3 (7 E^x + 2 E^(4 x)), {x, 0, 20}], x]*Table[n!, {n, 0, 20}] (* Stefano Spezia, Nov 10 2018 *)
-
PARI
a(n) = (2*4^n + 7)/3; \\ Michel Marcus, Nov 08 2018
-
PARI
Vec((3 - 10*x) / ((1 - x)*(1 - 4*x)) + O(x^30)) \\ Colin Barker, Nov 10 2018
Formula
O.g.f.: (3 - 10*x) / ((1 - x)*(1 - 4*x)). - Colin Barker, Nov 10 2018
E.g.f.: (1/3)*(7*exp(x) + 2*exp(4*x)). - Stefano Spezia, Nov 10 2018
a(n) = 5*a(n-1) - 4*a(n-2), a(0) = 3, a(1) = 5.
a(n) = 4*a(n-1) - 7, a(0) = 3.
a(n) = (2/3)*(4^n-1)/3 + 3.
a(n) = A193579(n)/3.
Extensions
More terms from Michel Marcus, Nov 08 2018
Comments
Links
Crossrefs
Programs
Mathematica
Formula