login

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”).

Numbers k such that the decimal digits of k + reverse(k) are 0 or 1.
1

%I #23 Sep 30 2023 16:31:57

%S 0,5,10,19,28,37,46,55,64,73,82,91,100,109,159,208,209,258,307,308,

%T 357,406,407,456,505,506,555,604,605,654,703,704,753,802,803,852,901,

%U 902,951,1000,1009,1010,1099,1100,1189,1199,1279,1289,1369,1379

%N Numbers k such that the decimal digits of k + reverse(k) are 0 or 1.

%H Daniel Starodubtsev, <a href="/A185440/b185440.txt">Table of n, a(n) for n = 0..10000</a>

%e 258 is in the sequence because 258 + 852 = 1110.

%p with(numtheory): for i from 0 to 2000 do: ii:=0:s1:=0:ll:=length(i):for

%p q from 0 to ll do:x:=iquo(i, 10^q):y:=irem(x, 10):s1:=s1+y*10^(ll-1-q): od:n:=i+s1:

%p l:=length(n):n0:=n:s:=0:for m from 0 to l-1 do:q:=n0:u:=irem(q,10):v:=iquo(q,10):n0:=v

%p : if u=0 or u=1 then ii:=ii+1:else fi:od:if ii=l then printf(`%d, `,i):else

%p fi:od:

%t Select[Range[0,2000],Max[IntegerDigits[# +IntegerReverse[#]]]<2&] (* _Harvey P. Dale_, Sep 30 2023 *)

%o (Sage)

%o reverse = lambda n: Integer(str(n)[::-1],base=10)

%o is_A185440 = lambda n: set((n+reverse(n)).digits()) <= set([0, 1])

%o a = filter(is_A185440, [0..10000]) # _D. S. McNeil_, Feb 04 2011

%o (Perl) for (my $k = 1; $k < 10000; $k++) {print "$k, " if (($k + reverse($k)) =~ m/^[01]+$/)} # _Charles R Greathouse IV_, Feb 04 2011

%o (PARI) isok(k) = if (k, vecmax(digits(k+fromdigits(Vecrev(digits(k))))) == 1, 1); \\ _Michel Marcus_, May 01 2021

%Y Cf. A056964.

%K nonn,base

%O 0,2

%A _Michel Lagneau_, Feb 03 2011