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

A049354 Digitally balanced numbers in base 3: equal numbers of 0's, 1's, 2's.

Original entry on oeis.org

11, 15, 19, 21, 260, 266, 268, 278, 290, 294, 302, 304, 308, 312, 316, 318, 332, 344, 348, 380, 384, 396, 410, 412, 416, 420, 424, 426, 434, 438, 450, 460, 462, 468, 500, 502, 508, 518, 520, 524, 528, 532, 534, 544, 550, 552, 572, 574, 578, 582, 586, 588, 596
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A049354-A049360. See also A061854, A037861.
Row n = 3 of A378000.

Programs

  • Haskell
    a049354 n = a049354_list !! (n-1)
    a049354_list = filter f [1..] where
       f n = t0 == a062756 n && t0 == a081603 n where t0 = a077267 n
    -- Reinhard Zumkeller, Aug 09 2014
    
  • Mathematica
    Select[Range[600],Length[Union[DigitCount[#,3]]]== 1&]
    FromDigits[#,3]&/@DeleteCases[Flatten[Permutations/@Table[PadRight[{},3n,{1,0,2}],{n,3}],1],?(#[[1]]==0&)]//Sort (* _Harvey P. Dale, May 30 2016 *)
    Select[Range@5000, Differences@DigitCount[#,3]=={0,0}&] (* Hans Rudolf Widmer, Dec 11 2021 *)
  • Python
    from sympy.ntheory import count_digits
    def ok(n): c = count_digits(n, 3); return c[0] == c[1] == c[2]
    print([k for k in range(600) if ok(k)]) # Michael S. Branicky, Nov 15 2021

Formula

A062756(a(n)) = A077267(a(n)) and A081603(a(n)) = A077267(a(n)). - Reinhard Zumkeller, Aug 09 2014

A144812 Integers having ideal digital mean up to base 7.

Original entry on oeis.org

36990, 37230, 43350, 45390, 2149023720, 2149218300, 2149279740, 2149513020, 2149527540, 2149545960, 2151079740, 2151628020, 2151662460, 2151667320, 2152716540, 2152720860, 2152724280, 2153463540, 2154166200, 2154948600, 2155019220, 2155051980, 2155196340
Offset: 1

Views

Author

Reikku Kulon, Sep 21 2008

Keywords

Comments

These numbers have digital mean dm(b, n) = (Sum_{i=1..d} 2*d_i - (b-1)) / (2*d) = 0, where d is the number of digits in the base b representation of n and d_i the individual digits, for 2 <= b <= 7.
There are no integers less than 2^32 for which this is true to base 8. It is believed there are either infinitely many starting at some larger n, or none. If they exist, it is conjectured that the set of all similar sequences continues at least to base ten, almost certainly to base 16 and likely to arbitrarily large b. Sequences for b at least ten have an intersection with A144777.

Crossrefs

A227870 Numbers with equal number of even and odd digits.

Original entry on oeis.org

10, 12, 14, 16, 18, 21, 23, 25, 27, 29, 30, 32, 34, 36, 38, 41, 43, 45, 47, 49, 50, 52, 54, 56, 58, 61, 63, 65, 67, 69, 70, 72, 74, 76, 78, 81, 83, 85, 87, 89, 90, 92, 94, 96, 98, 1001, 1003, 1005, 1007, 1009, 1010, 1012, 1014, 1016, 1018, 1021, 1023, 1025
Offset: 1

Views

Author

Jon Perry, Nov 02 2013

Keywords

Comments

Numbers with an odd digit length cannot be in this sequence. - Alonso del Arte, Nov 02 2013

Examples

			1009 has 2 even digits (00) and 2 odd digits (19) and so is in the sequence.
		

Crossrefs

Subsequence of A001637.

Programs

  • JavaScript
    for (i = 1; i < 5000; i++) {
    s = i.toString();
    odds = 0; evens = 0;
    for (j = 0; j < s.length; j++) if (s.charAt(j)%2 == 0) evens++; else odds++;
    if (odds == evens) document.write(i + ", ");
    }
    
  • Mathematica
    Select[Range[1025], (d = Differences[Tally[Mod[IntegerDigits[#], 2]]]) != {} && d[[1, 2]] == 0 &] (* Amiram Eldar, Oct 01 2020 *)
    eneodQ[n_]:=With[{id=IntegerDigits[n]},Count[id,?(OddQ[#]&)]==Count[id,?(EvenQ[#]&)]]; Select[Range[1100],eneodQ] (* Harvey P. Dale, Jul 19 2024 *)
  • PARI
    isok(m) = my(d=digits(m)); #select(x->(x%2), d) == #select(x->!(x%2), d); \\ Michel Marcus, Oct 01 2020
    
  • Python
    def ok(i):
      stri = str(i)
      se = sum(1 for d in stri if d in "02468")
      so = sum(1 for d in stri if d in "13579")
      return se == so
    def aupto(nn):
      alst, an = [None], 0
      for n in range(1, nn+1):
        while len(alst) < nn+1:
          if ok(an): alst.append(an)
          an += 1
      return alst[1:] # use alst[n] for a(n)
    print(aupto(58))  # Michael S. Branicky, Dec 14 2020

A378000 Array read by ascending antidiagonals: T(n,k) is the k-th positive integer that is digitally balanced in base n.

Original entry on oeis.org

2, 11, 9, 75, 15, 10, 694, 78, 19, 12, 8345, 698, 99, 21, 35, 123717, 8350, 714, 108, 260, 37, 2177399, 123723, 8375, 722, 114, 266, 38, 44317196, 2177406, 123759, 8385, 738, 120, 268, 41, 1023456789, 44317204, 2177455, 123771, 8410, 742, 135, 278, 42
Offset: 2

Views

Author

Paolo Xausa, Nov 14 2024

Keywords

Comments

A digitally balanced number in base b contains every digit from 0 to b-1 in equal amount.

Examples

			Array begins:
  n\k|           1            2            3            4            5  ...
  -------------------------------------------------------------------------
   2 |           2,           9,          10,          12,          35, ... = A031443
   3 |          11,          15,          19,          21,         260, ... = A049354
   4 |          75,          78,          99,         108,         114, ... = A049355
   5 |         694,         698,         714,         722,         738, ... = A049356
   6 |        8345,        8350,        8375,        8385,        8410, ... = A049357
   7 |      123717,      123723,      123759,      123771,      123807, ... = A049358
   8 |     2177399,     2177406,     2177455,     2177469,     2177518, ... = A049359
   9 |    44317196,    44317204,    44317268,    44317284,    44317348, ... = A049360
  10 |  1023456789,  1023456798,  1023456879,  1023456897,  1023456978, ...
  11 | 26432593615, 26432593625, 26432593725, 26432593745, 26432593845, ...
  ...         |                                                       \______ A378001 (main diagonal)
           A049363
T(2,4) = 12 = 1100_2 is the fourth number in base 2 containing an equal amount of zeros and ones.
T(9,5) = 44317348 = 102345867_9 is the fifth number in base 9 containing an equal amount of digits from 0 to 8.
		

Crossrefs

Cf. A049363 (first column, from n = 2), A378001 (main diagonal).

Programs

  • Mathematica
    Module[{dmax = 10, a, m}, a = Table[m = FromDigits[Join[{1, 0}, Range[2, n-1]], n] - 1; Table[While[!SameQ@@DigitCount[++m, n]]; m, dmax-n+2], {n, dmax+1, 2, -1}]; Array[Diagonal[a, # - dmax] &, dmax]]

A066196 Primes which have an equal number of zeros and ones in their binary expansion.

Original entry on oeis.org

2, 37, 41, 139, 149, 163, 197, 541, 557, 563, 569, 587, 601, 613, 617, 647, 653, 659, 661, 677, 709, 787, 809, 929, 2141, 2203, 2221, 2251, 2281, 2333, 2347, 2357, 2381, 2389, 2393, 2417, 2467, 2473, 2617, 2659, 2699, 2707, 2713, 2729, 2837, 2851, 2857
Offset: 1

Views

Author

Robert G. Wilson v, Dec 15 2001

Keywords

Crossrefs

Programs

  • Mathematica
    Prime[ Select[ Range[ 10^3 ], Count[ IntegerDigits[ Prime[ # ], 2 ], 0 ] == Count[ IntegerDigits[ Prime[ # ], 2 ], 1 ] & ] ]
    digBalQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ@(m = Length@d) && Count[d, 1] == m/2]; Select[Range[3000], PrimeQ[#] && digBalQ[#] &] (* Amiram Eldar, Nov 21 2020 *)
    Select[Prime[Range[500]],DigitCount[#,2,1]==DigitCount[#,2,0]&] (* Harvey P. Dale, Jun 24 2025 *)
  • PARI
    isok(p) = isprime(p) && (2*hammingweight(p) == #binary(p)); \\ Michel Marcus, May 16 2022
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def agen():
        yield from filter(isprime, (int("1"+"".join(p), 2) for n in count(1) for p in multiset_permutations("0"*n+"1"*(n-1))))
    print(list(islice(agen(), 50))) # Michael S. Branicky, May 15 2022

Formula

A000040 INTERSECT A031443. - R. J. Mathar, Jun 01 2011

A072600 Numbers which in base 2 have fewer 0's than 1's.

Original entry on oeis.org

1, 3, 5, 6, 7, 11, 13, 14, 15, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 39, 43, 45, 46, 47, 51, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 71, 75, 77, 78, 79, 83, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 99, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 23 2002

Keywords

Comments

A037861(a(n)) < 0.
b_k = {a(n) | for all n s.t. a(n) contains k binary digits equal to 1} is the list of all valid win/loss round sequences in a "best of 2k-1" two player game, where 1 is a win and 0 is a loss. For example 19 = 10011b represents a game where the winner won the first two rounds, lost the next two, and won the last one. |b_k| = A001700(k). - Philippe Beaudoin, May 14 2014

Examples

			11 is present because '1011' contains 1 '0' and 3 '1's: 1<3.
		

Crossrefs

Programs

  • Haskell
    a072600 n = a072600_list !! (n-1)
    a072600_list = filter ((< 0) . a037861) [0..]
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    Select[Range[130],DigitCount[#,2,0]Harvey P. Dale, Jan 12 2011 *)
  • PARI
    is(n)=2*hammingweight(n)>exponent(n)+1 \\ Charles R Greathouse IV, Apr 18 2020

A144912 Unreduced numerators of digital mean, dm_num(b, n), with rows n in {2, 3, 4, ...} and columns b in {2, 3, 4, ..., n}.

Original entry on oeis.org

0, 2, -2, -1, 0, -4, 1, 2, -2, -6, 1, 0, 0, -4, -8, 3, 2, 2, -2, -6, -10, -2, 4, -2, 0, -4, -8, -12, 0, -4, 0, 2, -2, -6, -10, -14, 0, -2, 2, -4, 0, -4, -8, -12, -16, 2, 0, 4, -2, 2, -2, -6, -10, -14, -18, 0, -2, 0, 0, -6, 0, -4, -8, -12, -16, -20
Offset: 2

Views

Author

Reikku Kulon, Sep 25 2008, Oct 03 2008

Keywords

Comments

The unreduced numerator of dm(b, n) is Sum_{i=1..d} (2*d_i - (b-1)), where d is the number of digits in the base b representation of n and d_i the individual digits. The corresponding denominator is 2 * d, giving a value in (-(b - 1) / 2, (b - 1) / 2] for n > 0.
dm_num(b, n) = d(b - 1) iff all the digits in n are b - 1.
dm_num(b, n) = -2(b - 2) for b = n, because n in base n is 10, giving dm_num(n, n) = 2 - n + 1 + 0 - n + 1 = 4 - 2 * n = -2(n - 2).
dm_num(b, n) = 0 for odd b and n having all digits equal to (b - 1) / 2, as well as for many other (b, n).
Defining m = ceiling((n + 1) / 2):
dm_num(b, n) = dm_num(b - 1, n) - 4 for b in [m + 1, n].
dm_num(m, n) = 0 for even n and 2 for odd n.
dm_num(m - 1, n) = 6 - n for even n > 4 and 9 - n for odd n > 5, producing a sequence of first differences {+2, -4, +2, -4, ...}.
Triangular patterns become clearly visible for large n, defined by additive periodicities along rational slopes. Zeros along the triangle borders correspond to ones in the Redheffer matrix until odd values become dominant. The line along m is the border between the two largest triangles. This pattern is masked by aliasing effects for small bases, notably including base 10, due to the thinness of the triangles which dominate at small b. Odd values may represent "artifacts" caused by "interference".

Examples

			Triangle begins:
   0;
   2, -2;
  -1,  0, -4;
   1,  2, -2, -6;
   1,  0,  0, -4, -8;
   3,  2,  2, -2, -6, -10;
   ...
		

Crossrefs

Programs

  • Mathematica
    dmnum[b_,n_]:=2Total[IntegerDigits[n,b]]-(b-1)Floor[Log[b,n*b]]; (* after Jinyuan Wang *)
    Table[dmnum[b,n],{n,2,10},{b,2,n}] (* Paolo Xausa, Sep 26 2023 *)
  • PARI
    dm(b, n) = 2*sumdigits(n, b) - (b-1)*logint(n*b, b); \\ Jinyuan Wang, Jul 21 2020

A061854 Nondiving binary sequences: numbers which in base 2 have at least the same number of 1's as 0's and reading the binary expansion from left (msb) to right (least significant bit), the number of 0's never exceeds the number of 1's.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 10, 11, 12, 13, 14, 15, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 42, 43, 44, 45, 46, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 113, 114, 115, 116
Offset: 1

Views

Author

Antti Karttunen, May 11 2001

Keywords

Comments

"msb" = "most significant bit", A053644.
These encode lattice walks using steps (+1,+1) (= 1's in binary expansion) and (+1,-1) (= 0's in binary expansion) that start from the origin (0,0) and never "dive" under the "sea-level" y=0.
The number of such walks of length n (here: the terms of binary width n) is given by C(n,floor(n/2)) = A001405, which is based on the fact mentioned in Guy's article that the shallow diagonals of the Catalan triangle A009766 sum to A001405.
From Jason Kimberley, Feb 08 2013: (Start)
This sequence is a subsequence of A072601.
Define a map from this set onto the nonnegative integers as follows: set the output bit string to be empty, representing zero; process the input string from left to right; when 1 occurs, change the rightmost 0 in the output to 1; if there is no 0 in the output, prepend a 1; when 0 occurs in the input, change the rightmost 1 in the output to 1. The definition of this sequence ensures that we always have a 1 in the output when a 0 occurs in the input. We this map is onto by showing the restriction to the subset Asubsequence is onto. (End)
The binary representation of a(n) is the numeric representation of the left half of a symmetric balanced string of parentheses with "(" representing 1 and ")" representing 0 (see comments and examples in A001405). Some of the numbers in this sequence cannot be realized as the 1-0-pattern of the odd/even positions of 1's in any row n of A237048 that determines the parts and their widths in the symmetric representation of sigma(n), see A352696. - Hartmut F. W. Hoft, Mar 29 2022

Examples

			From _Hartmut F. W. Hoft_, Mar 29 2022: (Start)
The columns in the table are the numbers n, the base-2 representation of n, the left half of the symmetric balanced string of parentheses corresponding to n, validity of the nondiving property for n, and associated number a(n):
1   1      (      True    a(1)
2   10     ()     True    a(2)
3   11     ((     True    a(3)
4   100    ())    False    -
5   101    ()(    True    a(4)
6   110    (()    True    a(5)
7   111    (((    True    a(6)
8   1000   ()))   False    -
9   1001   ())(   False    -
10  1010   ()()   True    a(7)
...
20  10100  ()())  False    -
21  10101  ()()(  True    a(13)
...
(End)
		

Crossrefs

Programs

  • Maple
    # We use a simple backtracking algorithm: map(op,[seq(NonDivingLatticeSequences(j),j=1..10)]);
    NDLS_GLOBAL := []; NonDivingLatticeSequences := proc(n) global NDLS_GLOBAL; NDLS_GLOBAL := []; NonDivingLatticeSequencesAux(0,0,n); RETURN(NDLS_GLOBAL); end;
    NonDivingLatticeSequencesAux := proc(x,h,i) global NDLS_GLOBAL; if(0 = i) then NDLS_GLOBAL := [op(NDLS_GLOBAL),x]; else if(h > 0) then NonDivingLatticeSequencesAux((2*x),h-1,i-1); fi; NonDivingLatticeSequencesAux((2*x)+1,h+1,i-1); fi; end;
  • Mathematica
    a061854[n_] := Select[Range[n], !MemberQ[FoldList[#1+If[#2>0, 1, -1]&, 0, IntegerDigits[n, 2]], -1]]
    a061854[116] (* Hartmut F. W. Hoft, Mar 29 2022 *)
    Select[Range[120],Min[Accumulate[IntegerDigits[#,2]/.(0->-1)]]>=0&] (* Harvey P. Dale, Sep 11 2023 *)

A090050 Numbers having equal length of longest contiguous block of zeros and ones in binary expansion.

Original entry on oeis.org

2, 5, 10, 12, 19, 21, 25, 38, 42, 44, 50, 51, 52, 56, 71, 75, 76, 77, 83, 85, 89, 100, 101, 102, 105, 108, 113, 142, 147, 150, 153, 154, 155, 166, 170, 172, 178, 179, 180, 184, 199, 201, 202, 203, 204, 205, 210, 211, 212, 217, 226, 227, 232, 240, 271, 279, 284
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Comments

A087117(a(n)) = A038374(a(n)), see also A000975.

Examples

			180 -> '10110100' with A087117(180)=2 and A038374(180)=2, therefore 180 is a term.
		

Crossrefs

Cf. A031443 (binary digitally balanced).

Programs

  • Haskell
    a090050 n = a090050_list !! (n+1)
    a090050_list = [x | x <- [1..], a087117 x == a038374 x]
    -- Reinhard Zumkeller, May 01 2012
  • Mathematica
    zobQ[n_]:=Module[{s=Split[IntegerDigits[n,2]]},Max[Length/@Select[ s, MemberQ[ #,0]&]] == Max[Length/@Select[s,MemberQ[#,1]&]]]; Select[ Range[ 300],zobQ] (* Harvey P. Dale, Aug 25 2019 *)
    Select[Range@1000, (s=Split@IntegerDigits[#,2]; Length@s>1 && Last@Differences@(Length@# & /@ Union@s) == 0) &] (* Hans Rudolf Widmer, Oct 10 2023 *)

Extensions

Definition corrected, thanks to Leroy Quet. - Sep 17 2008

A072603 Numbers which in base 2 have more 0's than 1's.

Original entry on oeis.org

4, 8, 16, 17, 18, 20, 24, 32, 33, 34, 36, 40, 48, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 76, 80, 81, 82, 84, 88, 96, 97, 98, 100, 104, 112, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 140, 144, 145, 146, 148, 152, 160, 161, 162, 164, 168, 176, 192, 193
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 23 2002

Keywords

Examples

			8 is present because '1000' contains 3 '0's and 1 '1': 3>1.
		

Crossrefs

Programs

  • Haskell
    a072603 n = a072603_list !! (n-1)
    a072603_list = filter ((> 0) . a037861) [1..]
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Mathematica
    gtQ[n_] := Module[{a, b}, {a, b} = DigitCount[n, 2]; b > a]; Select[Range[2^8], gtQ] (* T. D. Noe, Apr 20 2013 *)
    Select[Range[200],DigitCount[#,2,0]>DigitCount[#,2,1]&] (* Harvey P. Dale, Feb 26 2023 *)
  • PARI
    is(n)=2*hammingweight(n)Charles R Greathouse IV, Apr 18 2020
Previous Showing 31-40 of 102 results. Next