OFFSET
0,2
LINKS
Daniel Starodubtsev, Table of n, a(n) for n = 0..10000
EXAMPLE
258 is in the sequence because 258 + 852 = 1110.
MAPLE
with(numtheory): for i from 0 to 2000 do: ii:=0:s1:=0:ll:=length(i):for
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:
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
: if u=0 or u=1 then ii:=ii+1:else fi:od:if ii=l then printf(`%d, `, i):else
fi:od:
MATHEMATICA
Select[Range[0, 2000], Max[IntegerDigits[# +IntegerReverse[#]]]<2&] (* Harvey P. Dale, Sep 30 2023 *)
PROG
(Sage)
reverse = lambda n: Integer(str(n)[::-1], base=10)
is_A185440 = lambda n: set((n+reverse(n)).digits()) <= set([0, 1])
a = filter(is_A185440, [0..10000]) # D. S. McNeil, Feb 04 2011
(Perl) for (my $k = 1; $k < 10000; $k++) {print "$k, " if (($k + reverse($k)) =~ m/^[01]+$/)} # Charles R Greathouse IV, Feb 04 2011
(PARI) isok(k) = if (k, vecmax(digits(k+fromdigits(Vecrev(digits(k))))) == 1, 1); \\ Michel Marcus, May 01 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Feb 03 2011
STATUS
approved