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

A045690 Number of binary words of length n (beginning with 0) whose autocorrelation function is the indicator of a singleton.

Original entry on oeis.org

1, 1, 2, 3, 6, 10, 20, 37, 74, 142, 284, 558, 1116, 2212, 4424, 8811, 17622, 35170, 70340, 140538, 281076, 561868, 1123736, 2246914, 4493828, 8986540, 17973080, 35943948, 71887896, 143771368, 287542736, 575076661, 1150153322, 2300289022, 4600578044, 9201120918
Offset: 1

Views

Author

Torsten.Sillke(AT)uni-bielefeld.de

Keywords

Comments

The number of binary strings sharing the same autocorrelations.
Appears to be row sums of A155092, beginning from a(2). - Mats Granvik, Jan 20 2009
The number of binary words of length n (beginning with 0) which do not start with an even palindrome (i.e. which are not of the form ss*t where s is a (nonempty) word, s* is its reverse, and t is any (possibly empty) word). - Mamuka Jibladze, Sep 30 2014
From Gus Wiseman, Mar 08 2021: (Start)
This sequence counts each of the following essentially equivalent things:
1. Sets of distinct positive integers with maximum n in which all adjacent elements have quotients > 1/2. For example, the a(1) = 1 through a(6) = 10 sets are:
{1} {2} {3} {4} {5} {6}
{2,3} {3,4} {3,5} {4,6}
{2,3,4} {4,5} {5,6}
{2,3,5} {3,4,6}
{3,4,5} {3,5,6}
{2,3,4,5} {4,5,6}
{2,3,4,6}
{2,3,5,6}
{3,4,5,6}
{2,3,4,5,6}
2. For n > 1, sets of distinct positive integers with maximum n - 1 whose first-differences are term-wise less than their decapitation (remove the maximum). For example, the set q = {2,4,5} has first-differences (2,1), which are not less than (2,4), so q is not counted under a(5). On the other hand, r = {2,3,5,6} has first-differences {1,2,1}, which are less than {2,3,5}, so r is counted under a(6).
3. Compositions of n where each part after the first is less than the sum of all preceding parts. For example, the a(1) = 1 through a(6) = 10 compositions are:
(1) (2) (3) (4) (5) (6)
(21) (31) (41) (51)
(211) (32) (42)
(311) (411)
(212) (321)
(2111) (312)
(3111)
(2121)
(2112)
(21111)
(End)

Crossrefs

Cf. A002083, A005434. A003000 = 2*a(n) for n > 0.
Different from, but easily confused with, A007148 and A093371.
The version with quotients <= 1/2 is A018819.
The version with quotients < 1/2 is A040039.
Multiplicative versions are A337135, A342083, A342084, A342085.
A000045 counts sets containing n with all differences > 2.
A000929 counts partitions with no adjacent parts having quotient < 2.
A342094 counts partitions with no adjacent parts having quotient > 2.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 1/2,
           2*a(n-1)-`if`(n::odd, 0, a(n/2)))
        end:
    seq(a(n), n=1..40);  # Alois P. Heinz, Jun 24 2021
  • Mathematica
    a[1] = 1; a[n_] := a[n] = If[EvenQ[n], 2*a[n-1] - a[n/2], 2*a[n-1]]; Array[a, 40] (* Jean-François Alcover, Jul 17 2015 *)
    Table[Length[Select[Subsets[Range[n]],MemberQ[#,n]&&Min@@Divide@@@Partition[#,2,1]>1/2&]],{n,8}] (* Gus Wiseman, Mar 08 2021 *)
  • PARI
    a(n)=if(n<2,n>0,2*a(n-1)-(1-n%2)*a(n\2))

Formula

a(2n) = 2*a(2n-1) - a(n) for n >= 1; a(2n+1) = 2*a(2n) for n >= 1.
a(n) = A342085(2^n). - Gus Wiseman, Mar 08 2021

Extensions

More terms from James Sellers.
Additional comments from Michael Somos, Jun 09 2000

A122536 Number of binary sequences of length n with no initial repeats (or, with no final repeats).

Original entry on oeis.org

2, 2, 4, 6, 12, 20, 40, 74, 148, 286, 572, 1124, 2248, 4460, 8920, 17768, 35536, 70930, 141860, 283440, 566880, 1133200, 2266400, 4531686, 9063372, 18124522, 36249044, 72493652, 144987304, 289965744
Offset: 1

Views

Author

Sarah Nibs, Sep 18 2006

Keywords

Comments

An initial repeat of a string S is a number k>=1 such that S(i)=S(i+k) for i=0..k-1. In other words, the first k symbols are the same as the next k symbols, e.g., ABCDABCDZQQ has an initial repeat of size 4.
Equivalently, this is the number of binary sequences of length n with curling number 1. See A216955. - N. J. A. Sloane, Sep 26 2012

Examples

			a(4)=6: 0100, 0110, 0111, 1000, 1001 and 1011. (But not 00**, 11**, 0101, 1010.)
		

Crossrefs

Twice A093371. Leading column of each of the triangles A216955, A217209, A218869, A218870. Different from, but easily confused with, A003000 and A216957. - N. J. A. Sloane, Sep 26 2012
See A121880 for difference from 2^n.

Formula

Conjecture: a_n ~ C * 2^n where C is 0.27004339525895354325... [Chaffin, Linderman, Sloane, Wilks, 2012]
a(2n+1)=2*a(2n) = A211965(n+1), a(2n)=2*a(2n-1)-A216958(n) = A211966(n). - N. J. A. Sloane, Sep 28 2012
a(1) = 2; a(2n) = 2*[a(2n-1) - A216959(n)], n >= 1. - Daniel Forgues, Feb 25 2015

Extensions

a(31)-a(71) computed from recurrence and the first 30 terms of A216958 by N. J. A. Sloane, Sep 28 2012, Oct 25 2012

A216955 Triangle read by rows: T(n,k) (n>=1, 1<=k<=n) = number of binary sequences of length n and curling number k.

Original entry on oeis.org

2, 2, 2, 4, 2, 2, 6, 6, 2, 2, 12, 12, 4, 2, 2, 20, 26, 10, 4, 2, 2, 40, 52, 20, 8, 4, 2, 2, 74, 110, 38, 18, 8, 4, 2, 2, 148, 214, 82, 36, 16, 8, 4, 2, 2, 286, 438, 164, 70, 34, 16, 8, 4, 2, 2, 572, 876, 328, 140, 68, 32, 16, 8, 4, 2, 2, 1124, 1762, 660, 286, 134, 66, 32, 16, 8, 4, 2, 2, 2248, 3524, 1320, 572, 268, 132, 64, 32, 16, 8, 4, 2, 2
Offset: 1

Views

Author

N. J. A. Sloane, Sep 26 2012

Keywords

Comments

For definition of curling number see A216730.
"Binary" sequence means two-valued. It doesn't matter if the alphabet is {0,1} or {2,3}.
It appears that reversed rows converge to the sequence formed by the even terms of A090129. - Omar E. Pol, Nov 20 2012

Examples

			Triangle begins:
2,
2, 2,
4, 2, 2,
6, 6, 2, 2,
12, 12, 4, 2, 2,
20, 26, 10, 4, 2, 2,
40, 52, 20, 8, 4, 2, 2,
74, 110, 38, 18, 8, 4, 2, 2,
148, 214, 82, 36, 16, 8, 4, 2, 2,
286, 438, 164, 70, 34, 16, 8, 4, 2, 2,
...
		

Crossrefs

Leading columns are A122536 (or A093371), A217211, A217212. Cf. A216956, A217943.

Extensions

Extended to 104 rows by N. J. A. Sloane, Nov 15 2012

A007148 Number of self-complementary 2-colored bracelets (turnover necklaces) with 2n beads.

Original entry on oeis.org

1, 2, 3, 6, 10, 20, 37, 74, 143, 284, 559, 1114, 2206, 4394, 8740, 17418, 34696, 69194, 137971, 275280, 549258, 1096286, 2188333, 4369162, 8724154, 17422652, 34797199, 69505908, 138845926, 277383872, 554189329, 1107297290, 2212558942
Offset: 1

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Different from, but easily confused with, A045690 and A093371.

Programs

  • Maple
    # see A245558
    L := proc(n,k)
        local a,j ;
        a := 0 ;
        for j in numtheory[divisors](igcd(n,k)) do
            a := a+numtheory[mobius](j)*binomial(n/j,k/j) ;
        end do:
        a/n ;
    end proc:
    A007148 := proc(n)
        local a,k,l;
        a := 0 ;
        for k from 1 to n do
            for l in numtheory[divisors](igcd(n,k)) do
                a := a+L(n/l,k/l)*ceil(k/2/l) ;
            end do:
        end do:
        a;
    end proc:
    seq(A007148(n),n=1..20) ; # R. J. Mathar, Jul 23 2017
  • Mathematica
    a[n_] := (1/2)*(2^(n-1) + Total[ EulerPhi[2*#]*2^(n/#) &  /@ Divisors[n]]/(2*n)); Table[ a[n], {n, 1, 33}] (* Jean-François Alcover, Oct 25 2011 *)
  • PARI
    a(n)= (1/2) *(2^(n-1)+sumdiv(n,k,eulerphi(2*k)*2^(n/k))/(2*n))
    
  • Python
    from sympy import divisors, totient
    def a(n):
        if n==1: return 1
        return 2**(n - 2) + sum(totient(2*d)*2**(n//d) for d in divisors(n))//(4*n)
    print([a(n) for n in range(1, 31)]) # Indranil Ghosh, Jul 24 2017

Formula

a(n) = 2^(n-2) + (1/(4n)) * Sum_{d|n} phi(2d)*2^(n/d). - N. J. A. Sloane, Sep 25 2012
a(n) = (1/2)*(A000079(n-1) + A000013(n)).

Extensions

Description corrected by Christian G. Bower

A093370 Start with any initial string of n numbers s(1), ..., s(n), with s(1) = 2, other s(i)'s = 2 or 3 (so there are 2^(n-1) starting strings). The rule for extending the string is this as follows: To get s(n+1), write the string s(1)s(2)...s(n) as xy^k for words x and y (where y has positive length) and k is maximized, i.e., k = the maximal number of repeating blocks at the end of the sequence. Then a(n) = number of starting strings for which k > 1.

Original entry on oeis.org

0, 1, 2, 5, 10, 22, 44, 91, 182, 369, 738, 1486, 2972, 5962, 11924, 23884, 47768, 95607, 191214, 382568, 765136, 1530552, 3061104, 6122765, 12245530, 24492171, 48984342, 97970902, 195941804, 391888040
Offset: 1

Views

Author

N. J. A. Sloane, Apr 28 2004

Keywords

Examples

			For n=2 there are 2 starting strings, 22 and 23 and only the first has k > 1.
For n=4 there are 8 starting strings, but only 5 have k > 1, namely 2222, 2233, 2322, 2323, 2333.
		

Crossrefs

Formula

Equals A121880(n)/2, or 2^(n-1) - A122536(n)/2.
a(n)/2^(n-1) seems to converge to a number around 0.73.

Extensions

More terms from Sarah Nibs, via A122536, Sep 18 2006

A093369 a(n) = sum of lengths of strings that can be generated by any starting string of n 2's and 3's that starts with a 2, using the rule described in the Comments lines.

Original entry on oeis.org

1, 6, 14, 42, 98, 242, 552, 1394, 2935, 6471, 14006, 30060, 64223, 136914, 290224, 613509, 1292567, 2717311, 5696864, 11920124, 24889066, 51880008, 107954163, 224305440, 465388743, 964349526, 1995808823, 4125871527, 8520180124, 17577302639, 36228352911
Offset: 1

Views

Author

N. J. A. Sloane, Apr 28 2004

Keywords

Comments

Start with any initial string of n numbers s(1), ..., s(n), with s(1) = 2, other s(i)'s = 2 or 3 (so there are 2^(n-1) starting strings). The rule for extending the string is this:
To get s(i+1), write the string s(1)s(2)...s(i) as xy^k for words x and y (where y has positive length) and k is maximized, i.e. k = the maximal number of repeating blocks at the end of the sequence so far. Then s(i+1) = k if k >=2, but if k=1 you must stop (without writing down the 1).
a(n) = sum of final length of string, summed over all 2^(n-1) starting strings.

Examples

			a(3) = 14: the starting string, final string and length are as follows:
222 2223 4
223 223 3
232 232 3
233 2332 4, for a total of 4+3+3+4 = 14.
		

Crossrefs

Extensions

a(21)-a(31) from Lars Blomberg, Jul 25 2017

A211027 Triangle of binary numbers >= 1 with no initial repeats.

Original entry on oeis.org

1, 10, 100, 101, 1000, 1001, 1011, 10000, 10001, 10010, 10011, 10110, 10111, 100000, 100001, 100010, 100011, 100101, 100110, 100111, 101100, 101110, 101111, 1000000, 1000001, 1000010, 1000011, 1000100, 1000101, 1000110, 1000111, 1001010, 1001011, 1001100, 1001101, 1001110, 1001111, 1011000, 1011001, 1011100, 1011101, 1011110, 1011111
Offset: 1

Views

Author

Omar E. Pol, Nov 30 2012

Keywords

Comments

Triangle read by rows in which row n lists the binary numbers with n digits and with no initial repeats.
Also triangle read by rows in which row n lists the binary words of length n with no initial repeats and with initial digit 1. See also A211029.

Examples

			Triangle begins:
1;
10;
100, 101;
1000, 1001, 1011;
10000, 10001, 10010, 10011, 10110, 10111;
100000, 100001, 100010, 100011, 100101, 100110, 100111, 101100, 101110, 101111;
1000000, 1000001, 1000010, 1000011, 1000100, 1000101, 1000110, 1000111, 1001010, 1001011, 1001100, 1001101, 1001110, 1001111, 1011000, 1011001, 1011100, 1011101, 1011110, 1011111;
		

Crossrefs

Column 1 is A011557. Row n has length A093371(n).

Programs

  • Maple
    s:= proc(n) s(n):= `if`(n=1, [[1]], map(x->
          [[x[], 0], [x[], 1]][], s(n-1))) end:
    T:= proc(n) map(x-> parse(cat(x[])), select(proc(l) local i;
          for i to iquo(nops(l), 2) do if l[1..i]=l[i+1..2*i]
          then return false fi od; true end, s(n)))[] end:
    seq(T(n), n=1..7);  # Alois P. Heinz, Dec 02 2012
  • Mathematica
    T[n_] := If[n == 1, {1}, FromDigits /@ Select[Range[2^(n-1), 2^n-2] // IntegerDigits[#, 2]&, FindTransientRepeat[Reverse[#], 2][[2]] == {}&]];
    Array[T, 7] // Flatten (* Jean-François Alcover, Feb 27 2021 *)

A094005 a(n) = sum of lengths of strings that can be generated by any starting string of n 2's and 3's, using the rule described in the Comments lines.

Original entry on oeis.org

2, 11, 30, 82, 199, 480, 1097, 2630, 5828, 12830, 27873, 60071, 128355, 273543, 580149, 1226626, 2584822, 5433676, 11392986, 23838396, 49776503, 103755527, 215904926, 448602871, 930771041, 1928682932, 3991605129, 8251710234, 17040335019, 35154540729, 72456654860, 149208536983
Offset: 1

Views

Author

N. J. A. Sloane, May 31 2004

Keywords

Comments

Start with any initial string of n numbers s(1), ..., s(n), all = 2 or 3 (so there are 2^n starting strings). The rule for extending the string is this:
To get s(i+1), write the string s(1)s(2)...s(i) as xy^k for words x and y (where y has positive length) and k is maximized, i.e., k = the maximal number of repeating blocks at the end of the sequence so far (k is the curling number of s(1)s(2)...s(i)). Then s(i+1) = k if k >=2, but if k=1 you must stop (without writing down the 1).
a(n) = sum of final length of string, summed over all 2^n starting strings.
See A094004 for more terms. - N. J. A. Sloane, Dec 25 2012

Crossrefs

Formula

Equals A216813(n) + n*2^n. - N. J. A. Sloane, Sep 26 2012
A093369 is closely related.

Extensions

a(27)-a(31) from N. J. A. Sloane, Sep 19 2012

A211029 Triangle read by rows in which row n lists the binary words of length n over the alphabet {1,2} with no initial repeats.

Original entry on oeis.org

1, 2, 12, 21, 121, 122, 211, 212, 1211, 1221, 1222, 2111, 2112, 2122, 12111, 12112, 12211, 12212, 12221, 12222, 21111, 21112, 21121, 21122, 21221, 21222, 121111, 121112, 121122, 122111, 122112, 122121, 122211, 122212, 122221, 122222, 211111, 211112
Offset: 1

Views

Author

Omar E. Pol, Nov 29 2012

Keywords

Comments

As usual in the OEIS, binary alphabets are encoded with {1,2} over the alphabet {0,1} the entries contain nonzero "numbers" beginning with 0.

Examples

			The fourth row of triangle of binary sequences is
0100, 0110, 0111, 1000, 1001, 1011 (see section example of A122536) therefore the fourth row of this triangle is
1211, 1221, 1222, 2111, 2112, 2122.
The first six rows of triangle are:
1, 2;
12, 21;
121, 122, 211, 212;
1211, 1221, 1222, 2111, 2112, 2122;
12111, 12112, 12211, 12212, 12221, 12222, 21111, 21112, 21121, 21122, 21221, 21222;
121111, 121112, 121122, 122111, 122112, 122121, 122211, 122212, 122221, 122222, 211111, 211112, 211121, 211122, 211212, 211221, 211222, 212211, 212221, 212222;
		

Crossrefs

Row n has length A122536(n).

Programs

  • Maple
    s:= proc(n) s(n):= `if`(n=0, [[]], map(x->
          [[x[], 1], [x[], 2]][], s(n-1))) end:
    T:= proc(n) map(x-> parse(cat(x[])), select(proc(l) local i;
          for i to iquo(nops(l), 2) do if l[1..i]=l[i+1..2*i]
          then return false fi od; true end, s(n)))[] end:
    seq(T(n), n=1..7);  # Alois P. Heinz, Dec 02 2012

Extensions

More terms and name improved by R. J. Mathar, Nov 30 2012

A211968 Triangle of binary numbers with some initial repeats.

Original entry on oeis.org

11, 110, 111, 1010, 1100, 1101, 1110, 1111, 10100, 10101, 11000, 11001, 11010, 11011, 11100, 11101, 11110, 11111, 100100, 101000, 101001, 101010, 101011, 101101, 110000, 110001, 110010, 110011, 110100, 110101, 110110, 110111, 111000, 111001, 111010, 111011
Offset: 2

Views

Author

Omar E. Pol, Dec 03 2012

Keywords

Comments

Triangle read by rows in which row n lists the binary numbers with n digits and with some initial repeats, n >= 2.
Also triangle read by rows in which row n lists the binary words of length n with some initial repeats and with initial digit 1, n >= 2.

Examples

			Triangle begins, starting at row 2:
  11;
  110, 111;
  1010, 1100, 1101, 1110, 1111;
  10100, 10101, 11000, 11001, 11010, 11011, 11100, 11101, 11110, 11111;
		

Crossrefs

Complement in base 2 of A211027.
Rows lengths give: A093370.

Programs

  • Maple
    s:= proc(n) s(n):= `if`(n=1, [[1]], map(x->
          [[x[], 0], [x[], 1]][], s(n-1))) end:
    T:= proc(n) map(x-> parse(cat(x[])), select(proc(l) local i;
          for i to iquo(nops(l), 2) do if l[1..i]=l[i+1..2*i]
          then return true fi od; false end, s(n)))[] end:
    seq(T(n), n=2..7);  # Alois P. Heinz, Dec 04 2012
  • Mathematica
    T[n_] := FromDigits /@ Select[Range[2^(n-1), 2^n-1] // IntegerDigits[#, 2]&, FindTransientRepeat[Reverse[#], 2][[2]] != {}&];
    Table[T[n], {n, 2, 7}] // Flatten (* Jean-François Alcover, Feb 12 2025 *)
Showing 1-10 of 17 results. Next