login
Numbers n such that n+reverse(n) has only odd decimal digits (n not a multiple of 10).
1

%I #18 Aug 16 2022 02:50:51

%S 12,14,16,18,21,23,25,27,32,34,36,41,43,45,52,54,61,63,72,81,209,219,

%T 229,239,249,308,318,328,338,348,407,409,417,419,427,429,437,439,447,

%U 449,506,508,516,518,526,528,536,538,546,548,605,607,609,615,617,619

%N Numbers n such that n+reverse(n) has only odd decimal digits (n not a multiple of 10).

%C Obviously n is in the sequence iff reverse(n) is in the sequence.

%H Harvey P. Dale, <a href="/A135739/b135739.txt">Table of n, a(n) for n = 1..10000</a>

%H Project Euler, <a href="https://projecteuler.net/index.php?section=problems&amp;id=145">Problem 145: How many reversible numbers are there below one-billion?</a>

%e 409 + 904 = 1313 has only odd digits, so 409 and 904 are in the sequence.

%t odQ[n_]:=Module[{t=Count[IntegerDigits[n+FromDigits[Reverse[IntegerDigits[n]]]],_?EvenQ]},t==0&&!Divisible[n,10]]; Select[Range[700],odQ] (* _Harvey P. Dale_, Feb 20 2013 *)

%o (PARI) reverse(n,m)=n=[n];while(n=divrem(n[1],10),m=10*m+n[2]);m odd=Vec("13579");for(i=1,999,i%10&!setminus(Set(Vec(Str(i+reverse(i)))),odd)&print1(i", "))

%o (Python)

%o def ok(n): return n%10 and set(str(n + int(str(n)[::-1]))) <= set("13579")

%o print([k for k in range(620) if ok(k)]) # _Michael S. Branicky_, Aug 15 2022

%K base,easy,nonn

%O 1,1

%A _M. F. Hasler_, Dec 01 2007, Dec 05 2007