OFFSET
1,1
COMMENTS
A self-descriptive number in base b has b digits, indexed by 0 ... b-1 and for all n, the n-th digit equals the number of n's in the number. In base 10 there is exactly one such number, 6210001000.
From Iain Fox, Sep 16 2020: (Start)
(b-4)*b^(b-1) + 2*b^(b-2) + b^(b-3) + b^3 is in this sequence for b=4 and b>6.
For b>6, there exists exactly one self-descriptive number of base b. This number is of the form stated in the comment above.
Proof: A number in this sequence is of the form x_0*b^(b-1) + x_1*b^(b-2) + ... + x_{b-2}*b + x_{b-1} where x_i is an integer on the interval [0, b-1] and represents the number of times i appears in the sequence d = x_0, x_1, ..., x_{b-1}. Trivially, x_0 > 0. Let p be the number of nonzero terms in the sequence d. It is easy to see that p = Sum_{i=1..b-1} x_i. Since x_0 > 0, the number of nonzero terms in the sequence e = x_1, x_2, ..., x_{b-1} is p-1. Since the sum of the terms of e is one more than the number of nonzero terms in e, one term of e is 2 and the rest are either 0 or 1. This means that the only terms that can be in d are 0, 1, 2, and x_0, and thus there can be a maximum of four nonzero terms in d. Since there is a maximum of four nonzero terms in d, it is trivial that, for b>6, x_0>2. Thus, for b>6, there are exactly four nonzero terms in d. It is simple to determine that the four nonzero terms are x_0 = b-4, x_1 = 2, x_2 = 1, and x_{x_0} = x_{b-4} = 1.
(End)
REFERENCES
Clifford Pickover, Keys to Infinity, Chapter 28, "Chaos in Ontario." New York: Wiley, pp. 217-219, 1995.
LINKS
Iain Fox, Table of n, a(n) for n = 1..350
Eric Weisstein's World of Mathematics, Self-Descriptive Number.
Wikipedia, Self-descriptive number
FORMULA
EXAMPLE
1210_4 = 100, 2020_4 = 136, 21200_5 = 1425, 3211000_7 = 389305,
42101000_8 = 8946176, 521001000_9 = 225331713, 6210001000_10,
72100001000_11 = 186492227801, 821000001000_12 = 6073061476032,
9210000001000_13 = 213404945384449, (10)2100000001000_14 =
8054585122464440, (11)21000000001000_15 = 325144322753909625,
(12)21000000001000_16 = 13983676842985394176, etc.
MATHEMATICA
Do[id = IntegerDigits[n, base]; If[id == (Count[id, # ] & /@ Range[0, base - 1]), Print[n]], {base, 2, 10}, {n, base^(base - 1), (base^base) - 1, base}]
(* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) fQ[lst_] := (lst == (Count[lst, # ] & /@ Range[0, Length[lst] - 1])); f[n_] := Block[{pts = PadLeft[ #, n] & /@ Partitions[n], k = 1, l = PartitionsP[n], lst = {}}, While[k < l, AppendTo[ lst, FromDigits[ Flatten[ Select[ Permutations[ pts[[k]]], fQ[ # ] &]], n]]; k++ ]; Drop[ Union[ lst], 1]]; Table[ f[n], {n, 2, 15}] (* Robert G. Wilson v, Jun 07 2005 *)
PROG
(PARI) a(n)=if(n<4, [100, 136, 1425][n], (n+2)*(n*(n+3)-1)*(n+3)^n+(n+3)^3) \\ Iain Fox, Sep 16 2020
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Alonso del Arte, Jun 07 2005
EXTENSIONS
a(14)-a(17) from Iain Fox, Sep 16 2020
STATUS
approved