login
Zeroless numbers n such that n and n - (product of digits of n) are both palindromes.
2

%I #27 Nov 11 2024 16:44:23

%S 1,2,3,4,5,6,7,8,9,252,676,777,838,868,919,929,939,15451,15851,25152,

%T 25252,25352,25452,25552,25652,25752,25852,25952,29592,36563,51415,

%U 51815,52125,52225,52325,52425,52525,52625,52725,52825,52925,63536,92529,93939,97779,1455541,1545451,1558551,1594951

%N Zeroless numbers n such that n and n - (product of digits of n) are both palindromes.

%C Palindromes with nonzero digits in the sequence A229547.

%C Palindromes with an even number of digits do not appear to be in this sequence. - _Derek Orr_, Apr 05 2015

%H Chai Wah Wu, <a href="/A229761/b229761.txt">Table of n, a(n) for n = 1..10000</a>

%e 929 - (9*2*9) = 767 (another palindrome). So, 929 is a member of this sequence.

%t bpQ[n_]:=DigitCount[n,10,0]==0&&AllTrue[{n,n-Times@@IntegerDigits[n]},PalindromeQ]; Select[Range[16*10^5],bpQ] (* _Harvey P. Dale_, Nov 11 2024 *)

%o (Python)

%o def DP(n):

%o ..p = 1

%o ..for i in str(n):

%o ....p *= int(i)

%o ..return p

%o def pal(n):

%o ..r = ''

%o ..for i in str(n):

%o ....r = i + r

%o ..return r == str(n)

%o {print(n,end=', ') for n in range(1,10**6) if DP(n) and pal(n) and pal(n-DP(n))}

%o ## Simplified by _Derek Orr_, Apr 05 2015

%o (PARI) pal(n)=d=digits(n);Vecrev(d)==d

%o for(n=1,10^7,d=digits(n);p=prod(i=1,#d,d[i]);if(p&&pal(n)&&pal(n-p),print1(n,", "))) \\ _Derek Orr_, Apr 05 2015

%Y Cf. A229547, A007954.

%K nonn,easy,base,changed

%O 1,2

%A _Derek Orr_, Sep 30 2013

%E More terms from _Derek Orr_, Apr 05 2015