login
Numbers with exactly two distinct base-9 digits.
5

%I #18 Jun 06 2023 03:52:51

%S 9,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,31,32,33,34,

%T 35,36,37,38,39,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,

%U 61,62,63,64,65,66,67,68,69,71,72,73,74,75,76,77,78,79,81,82,90,92,93,94,95,96,97,98,100,101,109,111

%N Numbers with exactly two distinct base-9 digits.

%p isA031954 := proc(n)

%p local dgs,p,s ;

%p dgs := convert(convert(n,base,9),set) ;

%p if nops(dgs) = 2 then

%p true ;

%p else

%p false ;

%p end if ;

%p end proc:

%p A031954 := proc(n)

%p option remember ;

%p if n =1 then

%p 9 ;

%p else

%p for a from procname(n-1)+1 do

%p if isA031954(a) then

%p return a;

%p end if;

%p end do:

%p end if;

%p end proc:

%p seq(A031954(n),n=1..80) ; # _R. J. Mathar_, Jan 24 2023

%o (PARI) a(n)=n+8+(n+7)\9 \\ _Charles R Greathouse IV_, Mar 10 2021

%Y Cf. A007095.

%K nonn,base,easy

%O 1,1

%A _Clark Kimberling_