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.

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

This page as a plain text file.
%I A372146 #20 Jun 23 2024 16:53:23
%S A372146 1,11,105,420,924,2772,6240,4620,18480,13860,55440,69300,120120,
%T A372146 180180,240240,360360,514800,720720,1029600,1801800,2162160,2522520,
%U A372146 2282280,5045040,7207200,4564560,6846840,12612600,15135120,11411400,20540520,29343600,22822800,49729680
%N A372146 The smallest number k for which exactly n of its divisors are digitally balanced numbers in base 3 (A049354).
%e A372146 Since A049354(1) = 11 it follows that a(0) = 1.
%e A372146 The numbers 2 through 10 have no divisors in A049354 and A049354(1) = 11 = 102_3, so a(1) = 11.
%e A372146 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.
%p A372146 N:= 15: # for terms before the first term >= 3^(N+1)
%p A372146 db:= proc(n) option remember; local L,d,m;
%p A372146   L:= convert(n,base,3);
%p A372146   d:= nops(L);
%p A372146   d mod 3 = 0 and 3*numboccur(0,L) = d and 3*numboccur(1,L) = d
%p A372146 end proc:
%p A372146 W:= Vector(3^(N+1),datatype=integer[4]):
%p A372146 for d from 3 to N by 3 do
%p A372146   for t from 3^(d-1) to 3^d-1 do
%p A372146     if db(t) then
%p A372146           J:= [seq(i, i=t..3^(N+1), t)];
%p A372146           W[J]:= W[J] +~ 1;
%p A372146     fi
%p A372146 od od:
%p A372146 M:= max(W):
%p A372146 V:= Array(0..M): count:= 0:
%p A372146 for i from 1 to 3^(N+1) while count < M+1 do
%p A372146   if V[W[i]] = 0 then V[W[i]]:= i; count:= count+1 fi;
%p A372146 od:
%p A372146 L:= convert(V,list):
%p A372146 if not member(0,L,'m') then m:= M+2 fi:
%p A372146 L[1..m-1]; # _Robert Israel_, Jun 03 2024
%t A372146 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 *)
%o A372146 (Magma) bal:=func<n|Multiplicity(Intseq(n,3),1) eq Multiplicity(Intseq(n,3),0) and Multiplicity(Intseq(n,3),1) eq Multiplicity(Intseq(n,3),2)>; 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;
%Y A372146 Cf. A049354, A357035.
%K A372146 nonn,base
%O A372146 0,2
%A A372146 _Marius A. Burtea_, May 23 2024