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

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

A049363 a(1) = 1; for n > 1, smallest digitally balanced number in base n.

Original entry on oeis.org

1, 2, 11, 75, 694, 8345, 123717, 2177399, 44317196, 1023456789, 26432593615, 754777787027, 23609224079778, 802772380556705, 29480883458974409, 1162849439785405935, 49030176097150555672, 2200618769387072998445, 104753196945250864004691, 5271200265927977839335179
Offset: 1

Views

Author

Keywords

Comments

A037968(a(n)) = n and A037968(m) < n for m < a(n). - Reinhard Zumkeller, Oct 27 2003
Also smallest pandigital number in base n. - Franklin T. Adams-Watters, Nov 15 2006

Examples

			a(6) = 102345_6 = 1*6^5 + 2*6^3 + 3*6^2 + 4*6^1 + 5*6^0 = 8345.
		

Crossrefs

Column k=1 of A061845 and A378000 (for n>1).

Programs

  • Haskell
    a049363 n = foldl (\v d -> n * v + d) 0 (1 : 0 : [2..n-1])
    -- Reinhard Zumkeller, Apr 04 2012
    
  • Maple
    a:= n-> n^(n-1)+add((n-i)*n^(i-1), i=1..n-2):
    seq(a(n), n=1..23);  # Alois P. Heinz, May 02 2020
  • Mathematica
    Table[FromDigits[Join[{1,0},Range[2,n-1]],n],{n,20}] (* Harvey P. Dale, Oct 12 2012 *)
  • PARI
    A049363(n)=n^(n-1)+sum(i=1,n-2,n^(i-1)*(n-i))  \\ M. F. Hasler, Jan 10 2012
    
  • PARI
    A049363(n)=if(n>1,(n^n-n)/(n-1)^2+n^(n-2)*(n-1)-1,1)  \\ M. F. Hasler, Jan 12 2012
    
  • Python
    def A049363(n): return (n**n-n)//(n-1)**2+n**(n-2)*(n-1)-1 if n>1 else 1 # Chai Wah Wu, Mar 13 2024

Formula

a(n) = (102345....n-1) in base n. - Ulrich Schimke (ulrschimke(AT)aol.com)
For n > 1, a(n) = (n^n-n)/(n-1)^2 + n^(n-2)*(n-1) - 1 = A023811(n) + A053506(n). - Franklin T. Adams-Watters, Nov 15 2006
a(n) = n^(n-1) + Sum_{m=2..n-1} m * n^(n - 1 - m). - Alexander R. Povolotsky, Sep 18 2022

Extensions

More terms from Ulrich Schimke (ulrschimke(AT)aol.com)

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

A049355 Digitally balanced numbers in base 4: equal numbers of 0's, 1's, ... 3's.

Original entry on oeis.org

75, 78, 99, 108, 114, 120, 135, 141, 147, 156, 177, 180, 198, 201, 210, 216, 225, 228, 16815, 16827, 16830, 16875, 16878, 16890, 17007, 17019, 17022, 17055, 17079, 17085, 17115, 17118, 17127, 17133, 17142, 17145, 17259, 17262, 17274, 17307, 17310, 17319, 17325
Offset: 1

Views

Author

Keywords

Comments

The sum of reciprocals, Sum_{n>=1} 1/a(n), converges. In general, the sum of the reciprocals of balanced numbers in base b converges for all b >= 4, and diverges for b = 2 or 3 (Papanicolaou, 2013). Grivaux (2015) gives 3 * Sum_{k>=1} (4*k)!/(k!^4 * 4^(4*k)) = 0.857... as an upper bound for this sum. The sum is converging slowly: the sums of the reciprocals of the terms with no more than 4*k digits in base 4, for k = 1, 2, ..., are 0.129.., 0.183..., 0.213..., 0.233..., 0.248..., 0.260..., 0.269..., 0.276..., 0.282..., 0.288..., ... . - Amiram Eldar, Feb 15 2024

Crossrefs

Cf. A031443.
Row n = 4 of A378000.

Programs

  • Mathematica
    Select[Range[20000],Length[Union[DigitCount[#,4]]]==1&] (* Harvey P. Dale, Mar 19 2013 *)
    FromDigits[#,4]&/@DeleteCases[Flatten[Permutations/@Table[PadRight[{},4n,{1,0,2,3}],{n,2}],1],?(#[[1]]==0&)]//Sort (* _Harvey P. Dale, May 30 2016 *)
  • PARI
    is(n) = {my(c = matreduce(digits(n,4))[,2]); #c == 4 && #Set(c) == 1;} \\ Amiram Eldar, Feb 15 2024

Extensions

Offset corrected by Amiram Eldar, Feb 15 2024

A049360 Digitally balanced numbers in base 9: equal numbers of 0's, 1's, ..., 8's.

Original entry on oeis.org

44317196, 44317204, 44317268, 44317284, 44317348, 44317356, 44317844, 44317852, 44317988, 44318012, 44318068, 44318084, 44318564, 44318580, 44318636, 44318660, 44318796, 44318804, 44319292, 44319300, 44319364
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A031443.
Row n = 9 of A378000.

A049356 Digitally balanced numbers in base 5: equal numbers of 0's, 1's, ..., 4's.

Original entry on oeis.org

694, 698, 714, 722, 738, 742, 894, 898, 954, 970, 978, 990, 1014, 1022, 1054, 1070, 1102, 1110, 1138, 1142, 1178, 1190, 1202, 1210, 1294, 1298, 1334, 1346, 1358, 1366, 1394, 1398, 1454, 1470, 1478, 1490, 1634, 1646, 1654, 1670, 1726, 1730, 1758, 1766, 1778
Offset: 1

Views

Author

Keywords

Comments

The first 96 (=4*4!) terms of this sequence and of A031946 are identical. a(97) = 1001223344_5 = 1976724.

Examples

			a(1) = 10234_5 = 694.
a(96) = 43210_5 = 2930.
		

Crossrefs

Cf. A031443.
Subsequence of A031946.
Row n = 5 of A378000.

Programs

  • Mathematica
    Select[Range[5000], Length[Union[DigitCount[#, 5]]]==1&] (* Vincenzo Librandi, Apr 18 2013 *)

Extensions

Edited by Rick L. Shepherd, Jun 22 2003

A049357 Digitally balanced numbers in base 6: equal numbers of 0's, 1's, ..., 5's.

Original entry on oeis.org

8345, 8350, 8375, 8385, 8410, 8415, 8525, 8530, 8585, 8600, 8620, 8630, 8735, 8745, 8765, 8780, 8835, 8840, 8950, 8955, 8980, 8990, 9015, 9020, 10505, 10510, 10535, 10545, 10570, 10575, 11045, 11050, 11165, 11190, 11200, 11220, 11255
Offset: 1

Views

Author

Keywords

Comments

Subset of A031947. [R. J. Mathar, Oct 15 2008]

Examples

			8345 is 102345 in base 6.
		

Crossrefs

Cf. A031443.
Row n = 6 of A378000.

Programs

  • Maple
    isA049357 := proc(n)
        local ct60, ct61,ct62,ct63,ct64,ct65,d ;
        ct60 := 0 ; ct61 := 0 ; ct62 := 0 ;
        ct63 := 0 ; ct64 := 0 ; ct65 := 0 ;
        for d in convert(n,base,6) do
            if d = 0 then
                ct60 := ct60+1 ;
            elif d = 1 then
                ct61 := ct61+1 ;
            elif d =2 then
                ct62 := ct62+1 ;
            elif d =3 then
                ct63 := ct63+1 ;
            elif d =4 then
                ct64 := ct64+1 ;
            elif d =5 then
                ct65 := ct65+1 ;
            end if ;
        end do:
        if ct60 = ct61 and ct61 = ct62 and ct62 = ct63 and ct63 = ct64 and ct64 = ct65 then
            return true ;
        else
            return false;
        end if;
    end proc:
    for n from 1 to 12000 do
        if isA04957(n) then
            print(n);
        end if;
    end do: # R. J. Mathar, Aug 24 2023
  • Mathematica
    Select[Range[6000], Length[Union[DigitCount[#, 6]]] == 1 &] (* Vincenzo Librandi, Apr 18 2013 *)

A049358 Digitally balanced numbers in base 7: equal numbers of 0's, 1's, ..., 6's.

Original entry on oeis.org

123717, 123723, 123759, 123771, 123807, 123813, 124011, 124017, 124095, 124113, 124143, 124155, 124347, 124359, 124389, 124407, 124485, 124491, 124689, 124695, 124731, 124743, 124779, 124785, 125775, 125781, 125817, 125829, 125865, 125871, 126363, 126369
Offset: 1

Views

Author

Keywords

Comments

There are 4,320 terms with single numbers of the zero-to-six digits. - Harvey P. Dale, May 02 2025

Examples

			123717 is 1023456 in base 7.
		

Crossrefs

Cf. A031443.
Row n = 7 of A378000.

Programs

  • Mathematica
    Select[Range[126000], Length[Union[DigitCount[#, 7]]]==1&] (* Vincenzo Librandi, Apr 18 2013 *)
    FromDigits[IntegerDigits[#],7]&/@Select[FromDigits/@Permutations[Range[0,6]],IntegerLength[#]==7&] (* Harvey P. Dale, May 02 2025 *)

A049359 Digitally balanced numbers in base 8: equal numbers of 0's, 1's, ..., 7's.

Original entry on oeis.org

2177399, 2177406, 2177455, 2177469, 2177518, 2177525, 2177847, 2177854, 2177959, 2177980, 2178022, 2178036, 2178351, 2178365, 2178407, 2178428, 2178533, 2178540, 2178862, 2178869, 2178918, 2178932, 2178981, 2178988
Offset: 1

Views

Author

Keywords

Examples

			2177399 is 10234567 in base 8.
		

Crossrefs

Cf. A031443.
Row n = 8 of A378000.

Programs

  • Mathematica
    Select[Range[2100000,2200000],Union[DigitCount[#,8]]=={1}&] (* Harvey P. Dale, Sep 14 2012 *)

A378073 Positive integers that are digitally balanced in some integer base b >= 2.

Original entry on oeis.org

2, 9, 10, 11, 12, 15, 19, 21, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 75, 78, 99, 108, 114, 120, 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
Offset: 1

Views

Author

Paolo Xausa, Nov 16 2024

Keywords

Comments

A digitally balanced number in base b contains every digit from 0 to b-1 in equal amount.
This is the set of all of the distinct terms in A378000.

Examples

			99 is a term because it's a digitally balanced number in base 5 (99 = 12034_5).
135 is a term because it's a digitally balanced number in two bases (135 = 10000111_2 = 2013_4).
		

Crossrefs

Cf. A049364, A061845, A065963, A378000, A378080 (complement).
Supersequence of A378104.
Positions of positive terms in A378191.

Programs

  • Mathematica
    A378073Q[n_] := Module[{b = 1, len}, While[(len = IntegerLength[n, ++b]) >= b && !(Divisible[len, b] && SameQ @@ DigitCount[n, b])]; len >= b];
    Select[Range[500], A378073Q]
Showing 1-10 of 14 results. Next