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 21-30 of 43 results. Next

A089648 Numbers whose numbers of zeros and ones in binary representation differ at most by 1.

Original entry on oeis.org

0, 1, 2, 4, 5, 6, 9, 10, 12, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 67, 69, 70, 71, 73, 74, 75, 76, 77, 78, 81, 82, 83, 84, 85, 86, 88, 89, 90, 92, 97, 98, 99, 100, 101, 102, 104, 105, 106, 108, 112, 113, 114, 116, 120, 135, 139
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 02 2004

Keywords

Comments

A031443 is a subsequence; abs(A037861(a(n))) <= 1.

Crossrefs

Cf. A037861, union of A031443, A031444 and A031448.

Programs

  • Haskell
    a089648 n = a089648_list !! (n-1)
    a089648_list = filter ((<= 1) . abs . a037861) [0..]
    -- Reinhard Zumkeller, Mar 31 2015
  • Mathematica
    Select[Range[0,7! ],Abs[DigitCount[ #,2,0]-DigitCount[ #,2,1]]<2 &] (* Vladimir Joseph Stephan Orlovsky, Feb 16 2010 *)

A258002 Capped binary boundary codes for holeless strictly non-overlapping polyhexes (all orientations and rotations included).

Original entry on oeis.org

1, 127, 1519, 1783, 1915, 1981, 2014, 6007, 7099, 7645, 7918, 20335, 22447, 23479, 23503, 23995, 24187, 24253, 24286, 26551, 27607, 28123, 28135, 28381, 28477, 28510, 29659, 30187, 30445, 30451, 30574, 30622, 31213, 31477, 31606, 31609, 31990, 32122, 32188, 80815, 81271, 89527, 89551, 89719, 93655, 93883, 95191, 95707, 95719, 95965, 96061
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Comments

The sequence consists of those terms of A255571 whose every A080541/A080542-rotation is also a term of A255571 and in their binary representation the number of 1's is larger than the number of 0's. More precisely, after the initial term a(0)=1 (which stands for an empty path) each term has seven more 1's than 0's in their binary representation, i.e., A037861(a(n)) = -7 for all n >= 1.

Examples

			8167737748888 is included in the sequence, as it encodes a 42-edge polyhex pattern which is composed of two seven-hex "crowns" connected by a snake-like "S-piece".
		

Crossrefs

Intersection of A072600 and A258001.
Intersection of A255571 and A258012.
Subsequence: A258003 (lexicographically largest representatives).
Cf. A037861.
Differs from A258012 for the first time at n=6622.

A066879 n such that there are as many 1's as 0's in the base 2 expansion of Floor(n/2).

Original entry on oeis.org

4, 5, 18, 19, 20, 21, 24, 25, 70, 71, 74, 75, 76, 77, 82, 83, 84, 85, 88, 89, 98, 99, 100, 101, 104, 105, 112, 113, 270, 271, 278, 279, 282, 283, 284, 285, 294, 295, 298, 299, 300, 301, 306, 307, 308, 309, 312, 313, 326, 327, 330, 331, 332, 333, 338, 339, 340
Offset: 1

Views

Author

Joseph L. Pe, Jan 21 2002

Keywords

Comments

n such that there are as many odd as even terms in the orbit f(n), f(f(n)), f(f(f(n))), ..., 1, where f(k) = Floor(k/2).

Examples

			floor(18/2) = 9 = 1001 (base 2) has the same number of 1's as 0's. So 18 is a term of the sequence.
Also the orbit corresponding to 18 is 9, 4, 2, 1, which has an equal number (i.e. 2) of odd and even terms.
		

Crossrefs

Complement is the union of 1 and A126388.

Programs

  • Mathematica
    Select[Range[500],DigitCount[Floor[#/2],2,1]==DigitCount[Floor[#/2],2,0]&] (* Harvey P. Dale, Jan 14 2014 *)

Formula

A037861(Floor(n/2)) = 0.

Extensions

Extended and edited by John W. Layman, Jan 30 2002
New definition by Jonathan Sondow, Jun 10 2011

A258005 Capped binary boundary codes for holeless strictly non-overlapping polyhexes with bilateral symmetry, only the maximal representative from each equivalence class obtained by rotating.

Original entry on oeis.org

1, 127, 2014, 7918, 31606, 32122, 32188, 126394, 486838, 503482, 505564, 506332, 511708, 511804, 513514, 514936, 2012890, 2021098, 2025196, 2054044, 2055544, 7788250, 8050522, 8051434, 8051548, 8054620, 8075098, 8075110, 8084380, 8104888, 8182636, 8183020, 8185756, 8207218, 8207602, 8214442, 8219596, 8219602, 8231884, 8236516
Offset: 0

Views

Author

Antti Karttunen, May 31 2015

Keywords

Comments

Indexing starts from zero, because a(0) = 1 is a special case, indicating an empty path in the honeycomb lattice.
These are capped binary boundary codes for those holeless polyhexes that stay same when they are flipped over and rotated appropriately.
A258205(n) gives the count of terms with binary width 2n + 1.

Crossrefs

Intersection of A258003 and A258209. Differs from A258003 for the first time at n=8, where a(8) = 486838 while A258003(8) = 127930.
Subsequence of A258015 from which this differs for the first time at n=113.

A301336 a(n) = total number of 1's minus total number of 0's in binary expansions of 0, ..., n.

Original entry on oeis.org

-1, 0, 0, 2, 1, 2, 3, 6, 4, 4, 4, 6, 6, 8, 10, 14, 11, 10, 9, 10, 9, 10, 11, 14, 13, 14, 15, 18, 19, 22, 25, 30, 26, 24, 22, 22, 20, 20, 20, 22, 20, 20, 20, 22, 22, 24, 26, 30, 28, 28, 28, 30, 30, 32, 34, 38, 38, 40, 42, 46, 48, 52, 56, 62, 57, 54, 51, 50, 47, 46, 45, 46, 43, 42, 41, 42
Offset: 0

Views

Author

Ilya Gutkovskiy, Mar 28 2018

Keywords

Examples

			+---+-----+---+---+---+---+------------+
| n | bin.|1's|sum|0's|sum|    a(n)    |
+---+-----+---+---+---+---+------------+
| 0 |   0 | 0 | 0 | 1 | 1 | 0 - 1 =-1  |
| 1 |   1 | 1 | 1 | 0 | 1 | 1 - 1 = 0  |
| 2 |  10 | 1 | 2 | 1 | 2 | 2 - 2 = 0  |
| 3 |  11 | 2 | 4 | 0 | 2 | 4 - 2 = 2  |
| 4 | 100 | 1 | 5 | 2 | 4 | 5 - 4 = 1  |
| 5 | 101 | 2 | 7 | 1 | 5 | 7 - 5 = 2  |
| 6 | 110 | 2 | 9 | 1 | 6 | 9 - 6 = 3  |
+---+-----+---+---+---+---+------------+
bin. - n written in base 2;
1's - number of 1's in binary expansion of n;
0's - number of 0's in binary expansion of n;
sum - total number of 1's (or 0's) in binary expansions of 0, ..., n.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, -1,
          a(n-1)+add(2*i-1, i=Bits[Split](n)))
        end:
    seq(a(n), n=0..75);  # Alois P. Heinz, Nov 11 2024
  • Mathematica
    Accumulate[DigitCount[Range[0, 75], 2, 1] - DigitCount[Range[0, 75], 2, 0]]
  • Python
    def A301336(n):
        return sum(2*bin(i).count('1')-len(bin(i))+2 for i in range(n+1)) # Chai Wah Wu, Sep 03 2020
    
  • Python
    def A301336(n): return (n+1)*((n.bit_count()<<1)-(t:=(n+1).bit_length()))+(1<>j)-(r if n<<1>=m*(r:=k<<1|1) else 0)) for j in range(1,n.bit_length()+1))-2 # Chai Wah Wu, Nov 11 2024

Formula

G.f.: -1/(1 - x) + (1/(1 - x)^2)*Sum_{k>=0} x^(2^k)*(1 - x^(2^k))/(1 + x^(2^k)).
a(n) = A000788(n) - A059015(n).
a(n) = A268289(n) - 1.
a(A000079(n)) = A000295(n).

A274575 For m=1,2,3,... write all the 2^m binary vectors of length m in increasing order, and replace each vector with (number of 1's) - (number of 0's). Start with an initial 0 for the empty vector.

Original entry on oeis.org

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

Views

Author

Hans G. Oberlack, Jun 28 2016

Keywords

Comments

This is the sequence of To-And-Fro positions: Positions of all backward-forward combinations in lexicographical order when assigning -1 to a backward move and +1 to a forward move and starting at 0.
-a(n) are the slopes of the different segments, from left to right, of the successive steps in the construction of the Takagi (a.k.a. Blancmange) function. - Javier Múgica, Dec 31 2017

Examples

			Terms a(3) to a(6) correspond to the binary vectors 00, 01, 10, 11, which get replaced by -2, 0, 0, 2, respectively. Terms a(7) to a(14) correspond to the binary vectors 000, 001, ..., 111 which get replaced by -3, -1, ..., 3. a(0) = 0
a(1) = a('backward') = -1
a(2) = a('forward') = +1
a(3) = a('backward and backward') = -2
a(4) = a('backward and forward') = 0
a(5) = a('forward and backward') = 0
a(6) = a('forward and forward') = +2
a(7) = a('backward, backward and backward') = -3
a(8) = a('backward, backward and forward') = -1
Arranged as a tree read by rows:
               ______0______
              /             \
          __-1__           __1__
         /      \         /     \
       -2        0       0       2
       / \      / \     / \     / \
     -3  -1   -1   1  -1   1   1   3
. - _John Tyler Rascoe_, Sep 23 2023
		

Crossrefs

Cf. A037861.

Programs

  • BASIC
    Dim a(2*k+2)
    a(0) = 0
    For n = 0 To k
      a(2 * n + 1) = a(n) - 1
      a(2 * n + 2) = a(n) + 1
    Next n
    
  • Python
    def A274575_list(nmax):
        A = [0]
        for n in range(0,nmax):
            A.append(A[n//2]-(-1)**n)
        return(A)
    print(A274575_list(119)) # John Tyler Rascoe, Sep 23 2023

Formula

a(2*n + 1) = a(n) - 1; a(2*n + 2) = a(n) + 1.

Extensions

Edited by N. J. A. Sloane, Jul 27 2016

A372538 Numbers k such that the number of ones minus the number of zeros in the binary expansion of the k-th prime number is 1.

Original entry on oeis.org

3, 8, 20, 23, 24, 26, 30, 58, 61, 63, 65, 67, 78, 80, 81, 82, 84, 88, 185, 187, 194, 200, 201, 203, 213, 214, 215, 221, 225, 226, 227, 234, 237, 246, 249, 253, 255, 256, 257, 259, 266, 270, 280, 284, 287, 290, 573, 578, 586, 588, 591, 593, 611, 614, 615, 626
Offset: 1

Views

Author

Gus Wiseman, May 13 2024

Keywords

Examples

			The binary expansion of 83 is (1,0,1,0,0,1,1) with ones minus zeros 4 - 3 = 1, and 83 is the 23rd prime, so 23 is in the sequence.
The primes A000040(a(n)) together with their binary expansions and binary indices begin:
     5:           101 ~ {1,3}
    19:         10011 ~ {1,2,5}
    71:       1000111 ~ {1,2,3,7}
    83:       1010011 ~ {1,2,5,7}
    89:       1011001 ~ {1,4,5,7}
   101:       1100101 ~ {1,3,6,7}
   113:       1110001 ~ {1,5,6,7}
   271:     100001111 ~ {1,2,3,4,9}
   283:     100011011 ~ {1,2,4,5,9}
   307:     100110011 ~ {1,2,5,6,9}
   313:     100111001 ~ {1,4,5,6,9}
   331:     101001011 ~ {1,2,4,7,9}
   397:     110001101 ~ {1,3,4,8,9}
   409:     110011001 ~ {1,4,5,8,9}
   419:     110100011 ~ {1,2,6,8,9}
   421:     110100101 ~ {1,3,6,8,9}
   433:     110110001 ~ {1,5,6,8,9}
   457:     111001001 ~ {1,4,7,8,9}
  1103:   10001001111 ~ {1,2,3,4,7,11}
  1117:   10001011101 ~ {1,3,4,5,7,11}
  1181:   10010011101 ~ {1,3,4,5,8,11}
  1223:   10011000111 ~ {1,2,3,7,8,11}
		

Crossrefs

Restriction of A031448 to the primes, positions of ones in A145037.
Taking primes gives A095073, negative A095072.
Positions of ones in A372516, absolute value A177718.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives the length of an integer's binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    Select[Range[1000],DigitCount[Prime[#],2,1]-DigitCount[Prime[#],2,0]==1&]

A372539 Numbers k such that the number of ones minus the number of zeros in the binary expansion of the k-th prime number is -1.

Original entry on oeis.org

7, 19, 21, 25, 56, 57, 59, 60, 62, 68, 71, 77, 79, 87, 175, 177, 179, 180, 186, 188, 189, 192, 193, 195, 196, 197, 204, 210, 212, 216, 218, 243, 244, 248, 254, 262, 263, 265, 279, 567, 572, 576, 577, 583, 592, 598, 599, 600, 602, 603, 605, 606, 610, 613, 616
Offset: 1

Views

Author

Gus Wiseman, May 14 2024

Keywords

Examples

			The binary expansion of 17 is (1,0,0,0,1) with ones minus zeros 2 - 3 = -1, and 17 is the 7th prime, 7 is in the sequence.
The primes A000040(a(n)) together with their binary expansions and binary indices begin:
    17:         10001 ~ {1,5}
    67:       1000011 ~ {1,2,7}
    73:       1001001 ~ {1,4,7}
    97:       1100001 ~ {1,6,7}
   263:     100000111 ~ {1,2,3,9}
   269:     100001101 ~ {1,3,4,9}
   277:     100010101 ~ {1,3,5,9}
   281:     100011001 ~ {1,4,5,9}
   293:     100100101 ~ {1,3,6,9}
   337:     101010001 ~ {1,5,7,9}
   353:     101100001 ~ {1,6,7,9}
   389:     110000101 ~ {1,3,8,9}
   401:     110010001 ~ {1,5,8,9}
   449:     111000001 ~ {1,7,8,9}
  1039:   10000001111 ~ {1,2,3,4,11}
  1051:   10000011011 ~ {1,2,4,5,11}
  1063:   10000100111 ~ {1,2,3,6,11}
  1069:   10000101101 ~ {1,3,4,6,11}
  1109:   10001010101 ~ {1,3,5,7,11}
  1123:   10001100011 ~ {1,2,6,7,11}
  1129:   10001101001 ~ {1,4,6,7,11}
  1163:   10010001011 ~ {1,2,4,8,11}
		

Crossrefs

Restriction of A031444 (positions of '-1's in A145037) to A000040.
Taking primes gives A095072.
Positions of negative ones in A372516, absolute value A177718.
The negative version is A372538, taking primes A095073.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives the length of an integer's binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    Select[Range[1000],DigitCount[Prime[#],2,1]-DigitCount[Prime[#],2,0]==-1&]

A385587 Galileo sequence with ratio k = 4: 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, 4, 9, 11, 22, 23, 27, 28, 54, 56, 57, 58, 67, 68, 69, 71, 134, 136, 139, 141, 142, 143, 144, 146, 167, 168, 169, 171, 172, 173, 177, 178, 334, 336, 339, 341, 347, 348, 352, 353, 354, 356, 357, 358, 359, 361, 364, 366, 417, 418, 419, 421, 422, 423, 427, 428, 429
Offset: 1

Views

Author

Stefano Spezia, Jul 03 2025

Keywords

Comments

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)) = ...
In Tattersall reference the terms a(7) = 27 and a(8) = 28 miss.

Examples

			1/4 = (1 + 4)/(9 + 11) = (1 + 4 + 9)/(11 + 22 + 23) = ...
		

References

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

Crossrefs

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

Programs

  • Mathematica
    k=4; 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,57]

A385610 Galileo sequence with ratio k = 2: 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, 2, 2, 4, 2, 4, 5, 7, 2, 4, 5, 7, 7, 8, 10, 11, 2, 4, 5, 7, 7, 8, 10, 11, 10, 11, 11, 13, 14, 16, 16, 17, 2, 4, 5, 7, 7, 8, 10, 11, 10, 11, 11, 13, 14, 16, 16, 17, 14, 16, 16, 17, 16, 17, 19, 20, 20, 22, 23, 25, 23, 25, 25, 26, 2, 4, 5, 7, 7, 8, 10, 11, 10, 11
Offset: 1

Views

Author

Stefano Spezia, Jul 04 2025

Keywords

Comments

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/2 = (1 + 2)/(2 + 4) = (1 + 2 + 2)/(4 + 2 + 4) = ...
		

References

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

Crossrefs

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

Programs

  • Mathematica
    k=2; 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, 75]
Previous Showing 21-30 of 43 results. Next