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

A372146 The smallest number k for which exactly n of its divisors are digitally balanced numbers in base 3 (A049354).

Original entry on oeis.org

1, 11, 105, 420, 924, 2772, 6240, 4620, 18480, 13860, 55440, 69300, 120120, 180180, 240240, 360360, 514800, 720720, 1029600, 1801800, 2162160, 2522520, 2282280, 5045040, 7207200, 4564560, 6846840, 12612600, 15135120, 11411400, 20540520, 29343600, 22822800, 49729680
Offset: 0

Views

Author

Marius A. Burtea, May 23 2024

Keywords

Examples

			Since A049354(1) = 11 it follows that a(0) = 1.
The numbers 2 through 10 have no divisors in A049354 and A049354(1) = 11 = 102_3, so a(1) = 11.
105 has only two divisors in A049354, 15 = A049354(2) and 21 = A049354(4) and is the smallest with exactly two divisors in A049354, so a(2) = 105.
		

Crossrefs

Programs

  • Magma
    bal:=func; a:=[]; for n in [0..34] do k:=1; while #[d:d in Divisors(k)|bal(d)] ne n do k:=k+1; end while; Append(~a,k); end for; a;
  • Maple
    N:= 15: # for terms before the first term >= 3^(N+1)
    db:= proc(n) option remember; local L,d,m;
      L:= convert(n,base,3);
      d:= nops(L);
      d mod 3 = 0 and 3*numboccur(0,L) = d and 3*numboccur(1,L) = d
    end proc:
    W:= Vector(3^(N+1),datatype=integer[4]):
    for d from 3 to N by 3 do
      for t from 3^(d-1) to 3^d-1 do
        if db(t) then
              J:= [seq(i, i=t..3^(N+1), t)];
              W[J]:= W[J] +~ 1;
        fi
    od od:
    M:= max(W):
    V:= Array(0..M): count:= 0:
    for i from 1 to 3^(N+1) while count < M+1 do
      if V[W[i]] = 0 then V[W[i]]:= i; count:= count+1 fi;
    od:
    L:= convert(V,list):
    if not member(0,L,'m') then m:= M+2 fi:
    L[1..m-1]; # Robert Israel, Jun 03 2024
  • Mathematica
    balQ[n_, b_] := balQ[n, b] = MinMax@ Differences@ DigitCount[n, b] == {0, 0}; f[n_] := DivisorSum[n, 1 &, balQ[#, 3] &]; seq[len_, nmax_] := Module[{s = Table[0, {len}], c = 0, n = 1, i}, While[c < len && n < nmax, i = f[n] + 1; If[i <= len && s[[i]] == 0, c++; s[[i]] = n]; n++]; s]; seq[12, 10^5] (* Amiram Eldar, Jun 03 2024 *)

A372147 Numbers k for which k and k^2 are digitally balanced numbers in base 3 (A049354).

Original entry on oeis.org

500, 544, 550, 552, 588, 622, 307172, 307402, 307888, 308920, 309480, 309522, 309604, 310348, 310422, 310658, 310754, 310964, 310974, 310980, 311206, 311214, 311342, 311466, 311582, 311788, 311790, 312050, 312070, 312100, 313022, 313050, 313336, 313502, 313512
Offset: 1

Views

Author

Marius A. Burtea, May 23 2024

Keywords

Examples

			500 = 200112_3 and 500^2 = 250000 =110200221021_3, so 500 is a term.
544 = 202011_3 and 544^2 = 295936 =120000221121_3, so 544 is a term.
		

Crossrefs

Programs

  • Magma
    bal:=func; [n:n in [1..320000]|bal(n) and bal(n*n)];
  • Mathematica
    balQ[n_, b_] := MinMax@ Differences@ DigitCount[n, b] == {0, 0}; Select[Range[320000], balQ[#, 3] && balQ[#^2, 3] &] (* Amiram Eldar, Jun 03 2024 *)

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)

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

A049364 Smallest number that is digitally balanced in all bases 2, 3, ... n.

Original entry on oeis.org

2, 572, 8410815, 59609420837337474
Offset: 2

Views

Author

Keywords

Crossrefs

Cf. A031443, A049354, A049355, etc.
See A065963 for another version.

Extensions

a(5) from Joe K. Crump (joecr(AT)carolina.rr.com), Aug 29 2000, who reports that the next term is greater than 22185312344622607538702383625075608111920737991870030337.
a(6) > 5^434 and would be too large to include. This result comes from combining Joe K. Crump's algorithm with the observation that digitally balanced numbers in base 5 are all even and digitally balanced numbers in base 3 are even iff they are of even length. - Martin Fuller, Nov 27 2006

A031944 Numbers in which digits 0,1,2 all occur in base 3.

Original entry on oeis.org

11, 15, 19, 21, 29, 32, 33, 34, 35, 38, 42, 45, 46, 47, 48, 51, 55, 57, 58, 59, 61, 63, 64, 65, 66, 69, 73, 75, 83, 86, 87, 88, 89, 92, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 110, 113, 114, 115, 116, 119, 123, 126, 127, 128, 129, 132, 135
Offset: 1

Views

Author

Keywords

Comments

A043530(a(n)) = 3; complement of A154314. - Reinhard Zumkeller, Jan 07 2009
A212193(a(n)) = 3. - Reinhard Zumkeller, May 04 2012

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a031944 n = a031944_list !! (n-1)
    a031944_list = elemIndices 3 a212193_list
    -- Reinhard Zumkeller, May 04 2012
    
  • Mathematica
    Select[Range[200],Min[DigitCount[#,3]]>0&] (* Harvey P. Dale, Nov 21 2015 *)
  • Python
    from sympy.ntheory import count_digits
    def ok(n): c = count_digits(n, 3); return all(c[d] > 0 for d in [0, 1, 2])
    print([k for k in range(136) if ok(k)]) # Michael S. Branicky, Nov 15 2021

A065963 Smallest number which is digitally balanced in n bases, for 2 <= base b <= a(n).

Original entry on oeis.org

2, 135, 13575, 8451765, 71749827664620
Offset: 1

Views

Author

Naohiro Nomoto, Dec 08 2001

Keywords

Comments

See A049364 for another version.

Examples

			For n=3, a (3) = 13575. 11010100000111 (base 2), 200121210 (base 3), 142503 (base 6). 13575 is the minimum number which is digitally balanced in three bases.
		

Crossrefs

Extensions

71749827664620 from Martin Fuller, Oct 16 2006

A049361 Digitally balanced numbers in both bases 2 and 3.

Original entry on oeis.org

572, 678, 684, 8287, 8351, 8367, 8399, 8429, 8435, 8479, 8527, 8539, 8551, 8563, 8569, 8591, 8605, 8615, 8619, 8677, 8819, 8825, 8855, 8903, 8907, 8933, 8945, 8975, 8983, 9017, 9065, 9161, 9295, 9303, 9307, 9309, 9323, 9371, 9387, 9401
Offset: 1

Views

Author

Keywords

Crossrefs

Intersection of A031443 and A049354.

Programs

  • Mathematica
    With[{digMax = 3, termsNumber = 100}, Select[Union @@ Table[(FromDigits[#, 3] &) /@ Select[Permutations[Flatten[Table[Range[0, 2], k]]], #[[1]] > 0 &], {k, 1, digMax}], SameQ @@ DigitCount[#, 2, Range[0, 1]] &][[1 ;; termsNumber]]] (* Amiram Eldar, Feb 15 2024 *)

A049362 Digitally balanced numbers in bases 2, 3 and 4.

Original entry on oeis.org

8410815, 8411067, 8411631, 8411871, 8411895, 8412153, 8412855, 8413083, 8413161, 8416095, 8416119, 8416125, 8417133, 8417205, 8418795, 8418999, 8419035, 8419065, 8419743, 8419815, 8420055, 8420217, 8420253, 8427135
Offset: 1

Views

Author

Keywords

Comments

Is this sequence infinite?

Crossrefs

Intersection of A031443, A049354 and A049355.

Programs

  • Mathematica
    dbQ[n_, b_] := SameQ @@ DigitCount[n, b, Range[0, b - 1]]; With[{digMax = 3, termsNumber = 24}, Select[Union @@ Table[(FromDigits[#, 4] &) /@ Select[Permutations[Flatten[Table[Range[0, 3], k]]], #[[1]] > 0 &], {k, 1, digMax}], dbQ[#, 2] && dbQ[#, 3] &][[1 ;; termsNumber]]] (* Amiram Eldar, Feb 15 2024 *)
Showing 1-10 of 14 results. Next