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
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.
-
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;
-
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
-
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
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.
-
bal:=func; [n:n in [1..320000]|bal(n) and bal(n*n)];
-
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
9 is a term because '1001' contains 2 '0's and 2 '1's.
- Reikku Kulon, Table of n, a(n) for n = 1..10000
- Jason Bell, Thomas F. Lidbetter and Jeffrey Shallit, Additive number theory via approximation by regular languages, International Journal of Foundations of Computer Science, Vol. 31, No. 6 (2020), pp. 667-687; arXiv preprint, arXiv:1804.07996 [cs.FL], 2018.
- Thomas Finn Lidbetter, Counting, Adding, and Regular Languages, Master's Thesis, University of Waterloo, Ontario, Canada, 2018.
- Reinhard Zumkeller, Haskell Programs for Binary Digitally Balanced Numbers.
- Index entries for sequences related to binary expansion of n
Cf.
A049354-
A049360,
A000120,
A001316,
A006519,
A023416,
A070939,
A144777,
A145057,
A145058,
A145059,
A145060,
A144912,
A145037,
A191292,
A090050,
A014486,
A061854,
A037861,
A079309.
Terms of binary width n are enumerated by
A001700.
-
-- See link, showing that Ulrich Schimkes formula provides a very efficient algorithm. Reinhard Zumkeller, Jun 15 2011
-
[ n: n in [2..250] | Multiplicity({* z: z in Intseq(n,2) *}, 0) eq &+Intseq(n,2) ]; // Bruno Berselli, Jun 07 2011
-
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
-
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 *)
-
for(n=1,100,b=binary(n); l=length(b); if(sum(i=1,l, component(b,i))==l/2,print1(n,",")))
-
is(n)=hammingweight(n)==hammingweight(bitneg(n,#binary(n))) \\ Charles R Greathouse IV, Mar 29 2013
-
is(n)=2*hammingweight(n)==exponent(n)+1 \\ Charles R Greathouse IV, Apr 18 2020
-
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
-
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
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
a(6) = 102345_6 = 1*6^5 + 2*6^3 + 3*6^2 + 4*6^1 + 5*6^0 = 8345.
-
a049363 n = foldl (\v d -> n * v + d) 0 (1 : 0 : [2..n-1])
-- Reinhard Zumkeller, Apr 04 2012
-
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
-
Table[FromDigits[Join[{1,0},Range[2,n-1]],n],{n,20}] (* Harvey P. Dale, Oct 12 2012 *)
-
A049363(n)=n^(n-1)+sum(i=1,n-2,n^(i-1)*(n-i)) \\ M. F. Hasler, Jan 10 2012
-
A049363(n)=if(n>1,(n^n-n)/(n-1)^2+n^(n-2)*(n-1)-1,1) \\ M. F. Hasler, Jan 12 2012
-
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
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
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.
-
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
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
-
import Data.List (elemIndices)
a031944 n = a031944_list !! (n-1)
a031944_list = elemIndices 3 a212193_list
-- Reinhard Zumkeller, May 04 2012
-
Select[Range[200],Min[DigitCount[#,3]]>0&] (* Harvey P. Dale, Nov 21 2015 *)
-
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
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.
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
-
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
-
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.
Comments