A072543 Numbers whose largest decimal digit is also the initial digit.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 21, 22, 30, 31, 32, 33, 40, 41, 42, 43, 44, 50, 51, 52, 53, 54, 55, 60, 61, 62, 63, 64, 65, 66, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 110, 111, 200, 201
Offset: 1
Examples
a(10^ 1) = 9 a(10^ 2) = 411 a(10^ 3) = 6216 a(10^ 4) = 73474 a(10^ 5) = 813826 a(10^ 6) = 8512170 a(10^ 7) = 88368780 a(10^ 8) = 911960211 a(10^ 9) = 9237655227 a(10^10) = 93323313303
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A072544.
Programs
-
Haskell
a072543 n = a072543_list !! (n-1) a072543_list = [x | x <- [0..], a054055 x == a000030 x] -- Reinhard Zumkeller, Apr 25 2012
-
Maple
for i from 1 to 10 do A[i]:= i-1 od: count:= 10: for i from 1 to 9 do P[i]:= [seq([j],j=0..i)]; od: for d from 2 to 4 do for x from 1 to 9 do for p in P[x] do count:= count+1; A[count]:= add(p[k]*10^(k-1),k=1..d-1) + x*10^(d-1); od: P[x]:= [seq(seq([op(v),t], v=P[x]),t=0..x)]; od od: seq(A[i],i=1..count); # Robert Israel, Feb 01 2015
-
Mathematica
Select[Range[0,250],Max[IntegerDigits[#]]==First[IntegerDigits[#]]&] (* Harvey P. Dale, Apr 28 2016 *)
-
PARI
is(n)=n=digits(n); !#n || n[1]==vecmax(n) \\ Charles R Greathouse IV, Jan 02 2014
-
PARI
a(n)={d = 0; r = 1; s = 0; i = 0; if(n == 1, 0, n-=2; while(n > sum(i=0, 9,(i+1)^d), n-=sum(i=0, 9, (i+1)^d); n++; d++); while(n >= (r+1)^d, n -= (r+1)^d; r++);s = r * 10^d; while(n, s += 10^i*(n%(r+1)); n \= (r+1); i++));s } \\ David A. Corneth, Jan 31 2015
Extensions
Offset corrected by Reinhard Zumkeller, Apr 25 2012
Comments