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-6 of 6 results.

A031443 Digitally balanced numbers: positive numbers that in base 2 have the same number of 0's as 1's.

Original entry on oeis.org

2, 9, 10, 12, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 135, 139, 141, 142, 147, 149, 150, 153, 154, 156, 163, 165, 166, 169, 170, 172, 177, 178, 180, 184, 195, 197, 198, 201, 202, 204, 209, 210, 212, 216, 225, 226, 228, 232, 240, 527, 535, 539, 541, 542, 551
Offset: 1

Views

Author

Keywords

Comments

Also numbers k such that the binary digital mean dm(2, k) = (Sum_{i=1..d} 2*d_i - 1) / (2*d) = 0, where d is the number of digits in the binary representation of k and d_i the individual digits. - Reikku Kulon, Sep 21 2008
From Reikku Kulon, Sep 29 2008: (Start)
Each run of values begins with 2^(2k + 1) + 2^(k + 1) - 2^k - 1. The initial values increase according to the sequence {2^(k - 1), 2^(k - 2), 2^(k - 3), ..., 2^(k - k)}.
After this, the values follow a periodic sequence of increases by successive powers of two with single odd values interspersed.
Each run ends with an odd increase followed by increases of {2^(k - k), ..., 2^(k - 2), 2^(k - 1), 2^k}, finally reaching 2^(2k + 2) - 2^(k + 1).
Similar behavior occurs in other bases. (End)
Numbers k such that A000120(k)/A070939(k) = 1/2. - Ctibor O. Zizka, Oct 15 2008
Subsequence of A053754; A179888 is a subsequence. - Reinhard Zumkeller, Jul 31 2010
A000120(a(n)) = A023416(a(n)); A037861(a(n)) = 0.
A001700 gives number of terms having length 2*n in binary representation: A001700(n-1) = #{m: A070939(a(m))=2*n}. - Reinhard Zumkeller, Jun 08 2011
The number of terms below 2^k is A079309(floor(k/2)) for k > 1. - Amiram Eldar, Nov 21 2020

Examples

			9 is a term because '1001' contains 2 '0's and 2 '1's.
		

Crossrefs

Subsequence of A053754.
Row n = 2 of A378000.
Terms of binary width n are enumerated by A001700.

Programs

  • Haskell
    -- See link, showing that Ulrich Schimkes formula provides a very efficient algorithm. Reinhard Zumkeller, Jun 15 2011
    
  • Magma
    [ n: n in [2..250] | Multiplicity({* z: z in Intseq(n,2) *}, 0) eq &+Intseq(n,2) ];  // Bruno Berselli, Jun 07 2011
    
  • Maple
    a:=proc(n) local nn, n1, n0: nn:=convert(n,base,2): n1:=add(nn[i],i=1..nops(nn)): n0:=nops(nn)-n1: if n0=n1 then n else end if end proc: seq(a(n), n = 1..240); # Emeric Deutsch, Jul 31 2008
  • Mathematica
    Select[Range[250],DigitCount[#,2,1]==DigitCount[#,2,0]&] (* Harvey P. Dale, Jul 22 2013 *)
    FromDigits[#,2]&/@DeleteCases[Flatten[Permutations/@Table[PadRight[{},2n,{1,0}],{n,5}],1],?(#[[1]]==0&)]//Sort (* _Harvey P. Dale, May 30 2016 *)
  • PARI
    for(n=1,100,b=binary(n); l=length(b); if(sum(i=1,l, component(b,i))==l/2,print1(n,",")))
    
  • PARI
    is(n)=hammingweight(n)==hammingweight(bitneg(n,#binary(n))) \\ Charles R Greathouse IV, Mar 29 2013
    
  • PARI
    is(n)=2*hammingweight(n)==exponent(n)+1 \\ Charles R Greathouse IV, Apr 18 2020
    
  • Perl
    for my $half ( 1 .. 4 ) {
      my $N = 2 * $half;  # only even widths apply
      my $vector = (1 << ($N-1)) | ((1 << ($N/2-1)) - 1);  # first key
      my $n = 1; $n *= $_ for 2 .. $N;    # N!
      my $d = 1; $d *= $_ for 2 .. $N/2;  # (N/2)!
      for (1 .. $n/($d*$d*2)) {
        print "$vector, ";
        my ($v, $d) = ($vector, 0);
        until ($v & 1 or !$v) { $d = ($d << 1)|1; $v >>= 1 }
        $vector += $d + 1 + (($v ^ ($v + 1)) >> 2);  # next key
      }
    } # Ruud H.G. van Tol, Mar 30 2014
    
  • Python
    from sympy.utilities.iterables import multiset_permutations
    A031443_list = [int('1'+''.join(p),2) for n in range(1,10) for p in multiset_permutations('0'*n+'1'*(n-1))] # Chai Wah Wu, Nov 15 2019

Formula

a(n+1) = a(n) + 2^k + 2^(m-1) - 1 + floor((2^(k+m) - 2^k)/a(n))*(2^(2*m) + 2^(m-1)) where k is the largest integer such that 2^k divides a(n) and m is the largest integer such that 2^m divides a(n)/2^k+1. - Ulrich Schimke (UlrSchimke(AT)aol.com)
A145037(a(n)) = 0. - Reikku Kulon, Oct 02 2008

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

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]]

A145100 Integers in which no more than half the digits (rounded up) are the same, for all bases up to ten.

Original entry on oeis.org

1, 2, 17, 19, 25, 38, 52, 56, 75, 76, 82, 83, 90, 92, 97, 98, 100, 102, 104, 105, 108, 113, 116, 135, 139, 141, 142, 147, 150, 153, 163, 165, 177, 178, 180, 184, 195, 197, 198, 201, 204, 209, 210, 212, 225, 226, 232, 267, 269, 275, 278, 279, 291, 293, 294, 298
Offset: 1

Views

Author

Reikku Kulon, Oct 01 2008

Keywords

Examples

			267 in bases [2, 10] is 100001011, 100220, 10023, 2032, 1123, 531, 413, 326, 267. There are five zeros out of nine digits in its binary representation and no more than half the digits in the other bases are identical.
		

Crossrefs

A145101 Integers in which no digit occurs more than once more often than any other digit and not all repeated digits are identical, for all bases up to ten.

Original entry on oeis.org

1, 2, 17, 19, 25, 38, 52, 56, 75, 76, 82, 90, 92, 98, 100, 102, 104, 105, 108, 116, 141, 142, 150, 153, 177, 178, 180, 184, 195, 198, 204, 210, 212, 225, 226, 232, 294, 308, 316, 332, 395, 396, 410, 412, 420, 434, 450, 460, 481, 542, 572, 611, 689, 752, 818
Offset: 1

Views

Author

Reikku Kulon, Oct 01 2008

Keywords

Comments

Subset of A145100. The first number not in both sequences is 83.

Examples

			97 is in A145100 but not in this sequence: in base 3 it is 10121 and 1 occurs two times more often than either 0 or 2.
98 is in this sequence: in bases [2, 10] it is 1100010, 10122, 1202, 343, 242, 200, 142, 118, 98.
		

Crossrefs

A145104 Digitally fair numbers: integers n such that in all bases b = 2..10 no digit occurs more often than ceiling(d/b) times, where d is the number of digits of n in base b.

Original entry on oeis.org

1, 2, 19, 198, 25410896, 31596420, 10601629982, 10753657942, 11264883970, 11543640378, 11553029646, 11665278790, 12034384190, 12038440382, 12366849814, 12519032774, 12781964290, 12971872086, 13156400486
Offset: 1

Views

Author

Reikku Kulon, Oct 01 2008

Keywords

Comments

Presumed infinite. Next term >= 3^20.

Crossrefs

Extensions

More terms from Hagen von Eitzen, Jun 20 2009
Showing 1-6 of 6 results.