Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #38 Dec 22 2021 07:03:19
%S 12,22,32,42,52,62,72,82,92,120,121,122,123,124,125,126,127,128,129,
%T 220,221,222,223,224,225,226,227,228,229,320,321,322,323,324,325,326,
%U 327,328,329,420,421,422,423,424,425,426,427,428,429,520,521,522,523,524,525,526,527,528,529,620,621,622,623,624,625,626,627
%N Numbers k where "2" appears as the second digit of the decimal representation.
%C To find a(n), concatenate the first digit of n with 2 and then the other digits (if any) from n. See example. - _David A. Corneth_, Jun 12 2017
%H David A. Corneth, <a href="/A285470/b285470.txt">Table of n, a(n) for n = 1..10000</a>
%F From _Robert Israel_, Jun 12 2017: (Start)
%F a(10*n+j) = 10*a(n)+j for 0<=j<=9 and n >= 1.
%F G.f. g(x) satisfies g(x) = 10*(1-x^10)*g(x^10)/(1-x) + (x + 2*x + ... + 9*x^9)*x^10/(1-x^10) + 12*x + 22*x^2 + ... + 92*x^9. (End)
%e a(21) = 221, a(36) = 326.
%e As the first digit of 983 is 9, and the others are 83, a(983) = 9283. - _David A. Corneth_, Jun 12 2017
%p seq(seq(seq(a*10^d + 2*10^(d-1)+c, c=0..10^(d-1)-1),a=1..9),d=1..2); # _Robert Israel_, Jun 12 2017
%t Table[FromDigits@ Apply[Join, {{First@ #}, {2}, Rest@ #}] &@ IntegerDigits@ n, {n, 67}] (* _Michael De Vlieger_, Jun 12 2017 *)
%o (PARI) isok(n) = (n>9) && digits(n)[2] == 2; \\ _Michel Marcus_, Jun 12 2017
%o (PARI) a(n) = my(d = digits(n)); fromdigits(concat([d[1], [2], vector(#d-1, i, d[i+1])])) \\ _David A. Corneth_, Jun 12 2017
%o (PARI) nxt(n) = {if(isok(n+1), n+1, d = digits(n); t = 9*10^(#d-2); if(d[1]==9,t*=3); n+=t++) \\ _David A. Corneth_, Jun 12 2017
%o (Python)
%o def a(n): s = str(n); return int(s[0] + "2" + s[1:])
%o print([a(n) for n in range(1, 68)]) # _Michael S. Branicky_, Dec 22 2021
%Y Cf. A011532 (containing 2), A052404 (without 2), A217394 (starting with 2).
%K nonn,base,easy
%O 1,1
%A _Jamie Robert Creasey_, Apr 19 2017