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.

Previous Showing 31-40 of 43 results. Next

A385643 Galileo sequence with ratio k = 5: a(1) = 1, a(2) = k, a(2*n-1) = floor(((k + 1)*a(n) -1)/2), and a(2*n) = floor((k + 1)*a(n)/2) + 1 for n > 2.

Original entry on oeis.org

1, 5, 14, 16, 41, 43, 47, 49, 122, 124, 128, 130, 140, 142, 146, 148, 365, 367, 371, 373, 383, 385, 389, 391, 419, 421, 425, 427, 437, 439, 443, 445, 1094, 1096, 1100, 1102, 1112, 1114, 1118, 1120, 1148, 1150, 1154, 1156, 1166, 1168, 1172, 1174, 1256, 1258, 1262
Offset: 1

Views

Author

Stefano Spezia, Jul 06 2025

Keywords

Comments

Solution to Exercise 1.2.3 on page 35 in Tattersall.
A Galileo sequence of ratio k > 0 has the property that 1/k = a(1)/a(2) = (a(1) + a(2))/(a(3) + a(4)) = (a(1) + a(2) + a(3))/(a(4) + a(5) + a(6)) = ...

Examples

			1/5 = (1 + 5)/(14 + 16) = (1 + 5 + 14)/(16 + 41 + 43) = ...
		

References

  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 23, 35.

Crossrefs

Similar sequences for k=1..5: A037861, A385610, A005408 [Galileo, 1615], A385587, this sequence.

Programs

  • Mathematica
    k=5; a[1]=1; a[2]=k; a[n_]:=a[n]=If[OddQ[n], Floor[((k+1)*a[(n+1)/2]-1)/2], Floor[(k+1)*a[n/2]/2]+1]; Array[a, 51]

A114116 1's-counting matrix: row sums give number of 1's in binary expansion of n+1.

Original entry on oeis.org

1, 0, 1, 2, -1, 1, -1, 2, -1, 1, 1, 0, 1, -1, 1, 1, 0, 0, 1, -1, 1, 3, -2, 2, -1, 1, -1, 1, -2, 3, -2, 2, -1, 1, -1, 1, 0, 1, 0, 0, 1, -1, 1, -1, 1, 0, 1, 0, 0, 0, 1, -1, 1, -1, 1, 2, -1, 2, -2, 2, -1, 1, -1, 1, -1, 1, 0, 1, -1, 2, -2, 2, -1, 1, -1, 1, -1, 1, 2, -1, 1, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, 2, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, 4, -3, 3, -2, 2
Offset: 0

Views

Author

Paul Barry, Nov 13 2005

Keywords

Comments

First column is -A037861(n+1). Row sums are A000120. Product of partial sum matrix (1/(1-x),x) and A114115. Inverse is A114117.

Examples

			Triangle begins
1;
0, 1;
2,-1, 1;
-1, 2,-1, 1;
1, 0, 1,-1, 1;
1, 0, 0, 1,-1, 1;
3,-2, 2,-1, 1,-1, 1;
		

A126388 Denominators in a series for the "alternating Euler constant" log(4/Pi).

Original entry on oeis.org

2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 22, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 72, 73, 78, 79, 80, 81, 86, 87, 90, 91, 92
Offset: 2

Views

Author

Jonathan Sondow, Jan 01 2007

Keywords

Comments

All n > 1 such that (# of 1's) != (# of 0's) in the base 2 expansion of floor(n/2). The numerators of the series are A126389.

Examples

			floor(13/2) = 6 = 110 base 2, which has (# of 1's) = 2 != 1 = (#
of 0's), so 13 is a member.
		

Crossrefs

Complementary to A066879.

Programs

  • Mathematica
    b[n_] := DigitCount[n,2,1] - DigitCount[n,2,0]; L = {}; Do[If[b[Floor[n/2]] != 0, L = Append[L,n]], {n,2,100}]; L

Formula

log(4/Pi) = 1/2 - 1/3 + 2/6 - 2/7 - 1/8 + 1/9 + 1/10 - 1/11 + 1/12 - 1/13 + 3/14 - 3/15 - 2/16 + 2/17 + 2/22 - ...

A255568 Numbers in whose binary representation there are six 1-bits more than there are nonleading 0-bits.

Original entry on oeis.org

63, 191, 223, 239, 247, 251, 253, 254, 639, 703, 735, 751, 759, 763, 765, 766, 831, 863, 879, 887, 891, 893, 894, 927, 943, 951, 955, 957, 958, 975, 983, 987, 989, 990, 999, 1003, 1005, 1006, 1011, 1013, 1014, 1017, 1018, 1020, 2303, 2431, 2495, 2527, 2543, 2551, 2555
Offset: 1

Views

Author

Antti Karttunen, Mar 11 2015

Keywords

Comments

Numbers for which A037861(n) = -6.
Numbers in whose binary representation (A007088) the number of 1-bits = 6 + number of (nonleading) 0 bits.

Examples

			63 ("111111" in binary) is included because there are 0 zero-bits and six 1-bits.
191 ("10111111" in binary) is included because there is 1 zero-bit and seven 1-bits, thus there are six 1-bits more than the number of 0-bits.
		

Crossrefs

The intersection of A030130 and A023689 is a finite subsequence of this sequence.

Programs

A258001 Those terms of A255571 whose every A080541/A080542-rotation is also a term of A255571.

Original entry on oeis.org

1, 64, 127, 1057, 1090, 1156, 1288, 1519, 1552, 1783, 1915, 1981, 2014, 4369, 4642, 5188, 6007, 6280, 7099, 7645, 7918, 16963, 17029, 17161, 17542, 17545, 17674, 17938, 18529, 18577, 18700, 18706, 18964, 19492, 20335, 20641, 20674, 20770, 21016, 21028, 21544, 22447, 22600, 23479, 23503, 23995, 24187, 24253, 24286, 24865, 24898, 24964
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Comments

These are the numbers whose binary representation traces a nonselfcrossing circuit in honeycomb lattice when its bits (from the least to the second most significant bit; the most significant 1-bit is ignored) are interpreted as directions to proceed at each vertex, with an additional condition that the final direction (angle) must be equal to the starting direction of the walk. Because each bit either adds or subtracts 60 degrees from the current phase angle, it implies that for all terms after the initial term a(1)=0 (which stands for an empty path), the difference between the number of 0-bits and 1-bits (when excluding the most significant bit which is always 1) must be either -6 or +6. And indeed, for all n >= 1, A037861(a(n)) is either 5 or -7 as A037861 takes also the most significant bit into account.

Crossrefs

Subsequence of A255571.
Cf. A258002 (a subsequence; terms that have more ones than zeros in their binary representation).

A031461 Numbers whose base-4 representation has the same number of 0's as 3's.

Original entry on oeis.org

1, 2, 5, 6, 9, 10, 12, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 71, 75, 77, 78, 83, 85, 86, 89, 90, 92, 99, 101, 102, 105, 106, 108, 113, 114, 116, 120, 135, 139, 141, 142, 147, 149, 150, 153, 154, 156, 163, 165
Offset: 1

Views

Author

Keywords

Comments

Union of A031443 and A031448, i.e., numbers k in binary where the difference between numbers of 1's and 0's [A000120(k) - A023416(k) = -A037861(k)] is 1 or 0. - Henry Bottomley, Mar 02 2001

Crossrefs

Programs

  • Mathematica
    Select[Range[165], Equal @@ DigitCount[#, 4, {0, 3}] &] (* Amiram Eldar, Aug 03 2023 *)

A126389 Numerators in a series for the "alternating Euler constant" log(4/Pi).

Original entry on oeis.org

1, -1, 2, -2, -1, 1, 1, -1, 1, -1, 3, -3, -2, 2, 2, -2, 2, -2, 2, -2, 4, -4, -3, 3, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 3, -3, -1, 1, 1, -1, 1, -1, 3, -3, 1, -1, 3, -3, 3, -3, 5, -5, -4, 4, -2, 2, -2, 2, -2, 2, 2, -2, -2, 2, 2, -2, 2, -2, 2, -2, 4, -4, -2, 2
Offset: 2

Views

Author

Jonathan Sondow, Jan 01 2007

Keywords

Comments

Nonzero values of (-1)^n*b(floor(n/2)) for n > 1, where b(n) = (# of 1's) - (# of 0's) in the base 2 expansion of n. The denominators of the series are A126388.

Examples

			floor(15/2) = 7 = 111 base 2, which has (# of 1's) - (# of 0's) = 3, so (-1)^15*3 = -3 is a term.
		

Crossrefs

Programs

  • Mathematica
    b[n_] := DigitCount[n,2,1] - DigitCount[n,2,0]; L = {}; Do[If[b[Floor[n/2]] != 0, L = Append[L,(-1)^n*b[Floor[n/2]]]], {n,2,100}]; L

Formula

Log(4/Pi) = 1/2 - 1/3 + 2/6 - 2/7 - 1/8 + 1/9 + 1/10 - 1/11 + 1/12 - 1/13 + 3/14 - 3/15 - 2/16 + 2/17 + 2/22 - ...

A143903 A positive integer k is included if |(number of 0's in binary k) - (number of 1's in binary k)| divides k.

Original entry on oeis.org

1, 4, 5, 6, 8, 14, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 34, 36, 40, 46, 48, 54, 58, 60, 66, 67, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 95, 96, 97, 98, 99, 100, 101, 102, 104, 105, 106, 108, 112, 113, 114, 116
Offset: 1

Views

Author

Leroy Quet, Sep 04 2008

Keywords

Examples

			27 in binary is 11011. The number of 0's is 1. The number of 1's is 4. Since |1-4|=3 divides 27, 27 is a term of the sequence.
		

Crossrefs

Cf. A037861.

Programs

  • Mathematica
    Select[Range[100], Abs[DigitCount[ #, 2, 1] - DigitCount[ #, 2, 0]] > 0 && Mod[ #, Abs[DigitCount[ #, 2, 1] - DigitCount[ #, 2, 0]]] == 0 &] (* Stefan Steinerberger, Sep 05 2008 *)

Extensions

More terms from Stefan Steinerberger, Sep 05 2008

A303065 Number of numbers < n whose binary representation has the same difference between the numbers of 0's and 1's as n does.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 0, 0, 1, 2, 1, 3, 2, 3, 0, 0, 2, 3, 3, 4, 4, 5, 1, 5, 6, 7, 2, 8, 3, 4, 0, 0, 1, 2, 4, 3, 5, 6, 4, 4, 7, 8, 5, 9, 6, 7, 1, 5, 10, 11, 8, 12, 9, 10, 2, 13, 11, 12, 3, 13, 4, 5, 0, 0, 1, 2, 6, 3, 7, 8, 9, 4, 9, 10, 10, 11, 11, 12, 5, 5, 12, 13
Offset: 0

Views

Author

Alex Ratushnyak, Apr 17 2018

Keywords

Comments

First occurrence of k, k=0,1,2,...: 0, 4, 6, 12, 20, 22, 25, 26, 28, 44, 49, ..., . - Robert G. Wilson v, Feb 08 2018
Ordinal transform of A037861, minus one. - David Radcliffe, May 21 2025

Examples

			There are two numbers below 6 with number of 1's in the binary representation minus number of 0's equal to 1, namely 1 and 5, therefore a(6)=2.
There are 3 numbers below 12 with number of 1's in the binary representation minus number of 0's equal to 0, namely 2, 9, 10, therefore a(12)=3.
		

Crossrefs

Programs

  • Maple
    b:= n-> `if`(n=0, 1, add(1-2*i, i=Bits[Split](n))):
    p:= proc() -1 end:
    a:= proc(n) option remember; local t;
          t:= b(n); p(t):= p(t)+1
        end:
    seq(a(n), n=0..82);  # Alois P. Heinz, May 21 2025
  • Mathematica
    d[n_] := DigitCount[n, 2, 1] - DigitCount[n, 2, 0]; f[n_] := Block[{fd = d[n], c = k = 0}, While[k < n, If[d@ k == fd, c++]; k++]; c]; Array[f, 83, 0] (* Robert G. Wilson v, Feb 08 2018 *)
  • Python
    d=[0]*200
    for n in range(1024):
        b = bin(n)[2:]
        c0 = b.count('0')
        c1 = len(b) - c0
        diff = c0 - c1
        print(d[100+diff], end=', ')
        d[100+diff] += 1
    
  • Python
    from collections import Counter
    from itertools import count, islice
    def a303065_gen():
        counter = Counter()
        for n in count():
            bitstring = format(n, 'b')
            diff = bitstring.count('1') - bitstring.count('0')
            yield counter[diff]
            counter[diff] += 1
    a303065_list = list(islice(a303065_gen(), 83)) # David Radcliffe, May 21 2025

Formula

a(n) = 0 iff n belongs to A097110. - Rémy Sigrist, May 16 2018

Extensions

Offset corrected by David Radcliffe, May 21 2025

A344985 Sum of imbalance of all initial subsequences of the binary representation of n.

Original entry on oeis.org

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

Views

Author

André Engels, Jun 04 2021

Keywords

Comments

The imbalance of a sequence of zeros and ones is given as the absolute value of the difference between the number of zeros and the number of ones (that is, the absolute value of A037861 if n is the sequence A007088).

Examples

			9 in binary is 1001. The imbalance of 1 is 1, the imbalance of 10 is 0, the imbalance of 100 is 1 and the imbalance of 1001 is 0. thus a(9)=1+0+1+0=2.
		

Crossrefs

Programs

  • Maple
    imbal := proc(L)
         abs(numboccur(0, L) - numboccur(1, L))
    end proc:
    A344985 := proc(n)
        dgs := ListTools[Reverse](convert(n,base,2)) ;
        add(imbal( dgs[1..l]),l=1..nops(dgs)) ;
    end proc: # R. J. Mathar, Jul 07 2021
    # second Maple program:
    a:= proc(n) option remember; `if`(n=0, 0, a(iquo(n, 2))+
          (l-> abs(add(1-2*i, i=l)))(Bits[Split](n)))
        end:
    seq(a(n), n=1..80);  # Alois P. Heinz, Jul 07 2021
  • PARI
    a(n) = my(b=binary(n)); sum(k=1, #b, abs(sum(j=1, k, b[j]==1) - sum(j=1, k, b[j]==0))); \\ Michel Marcus, Jun 09 2021
    
  • Python
    def A344985(n):
        s, c, b = bin(n)[2:], 0, 0
        for x in s:
            b += 1 if x == '1' else -1
            c += abs(b)
        return c # Chai Wah Wu, Jul 07 2021

Formula

a(n) = a(floor(n/2)) + |A037861(n)|. - R. J. Mathar, Jul 07 2021
Previous Showing 31-40 of 43 results. Next