login
Numbers with at least two identical neighboring digits in their decimal representation.
18

%I #24 Jun 08 2020 05:31:19

%S 11,22,33,44,55,66,77,88,99,100,110,111,112,113,114,115,116,117,118,

%T 119,122,133,144,155,166,177,188,199,200,211,220,221,222,223,224,225,

%U 226,227,228,229,233,244,255,266,277,288,299,300,311,322,330,331,332,333

%N Numbers with at least two identical neighboring digits in their decimal representation.

%C A171902(n) = a(n+1) - a(n) <= 11.

%C Complement of A043096; A196368(a(n)) = 0.

%H Reinhard Zumkeller, <a href="/A171901/b171901.txt">Table of n, a(n) for n = 1..10000</a>

%t Select[Range[350],SequenceCount[IntegerDigits[#],{___,x_,x_,___}]>0&] (* The program uses the SequenceCount function from Mathematica version 10 *) (* _Harvey P. Dale_, May 14 2016 *)

%o (Haskell)

%o import Data.List (elemIndices)

%o a171901 n = a171901_list !! n

%o a171901_list = elemIndices 0 a196368_list

%o -- _Reinhard Zumkeller_, Oct 29 2001

%o (Python)

%o def is_ok(n):

%o s = str(n)

%o return any(s[i] == s[i - 1] for i in range(1, len(s)))

%o A171901_list = [n for n in range(400) if is_ok(n)] # _Chai Wah Wu_, Feb 14 2019

%Y Cf. A044821, A171903, A171904.

%K base,nonn

%O 1,1

%A _Reinhard Zumkeller_, Feb 07 2010