A117228
Palindromes which are divisible by the product and by the sum of their digits.
Original entry on oeis.org
1, 2, 3, 4, 5, 6, 7, 8, 9, 111, 2112, 4224, 13131, 21112, 21312, 31113, 42624, 211112, 234432, 1113111, 2111112, 2114112, 2118112, 21122112, 61111116, 111111111, 211121112, 211242112, 211262112, 213141312, 2111111112, 2112332112, 2114114112, 2131221312
Offset: 1
42624 is divisible by 4*2*6*2*4 and by 4+2+6+2+4.
-
rev(n)=r="";d=digits(n);for(i=1,#d,r=concat(Str(d[i]),r));eval(r)
for(n=1,10^7,d=digits(n);if(rev(n)==n,p=prod(i=1,#d,d[i]);if(p&&n%p==0&&n%sumdigits(n)==0,print1(n,", ")))) \\ Derek Orr, Aug 25 2014
-
from operator import mul
from functools import reduce
from gmpy2 import t_mod, mpz
A117228 = sorted([mpz(n) for n in (str(x)+str(x)[::-1] for x in range(1, 10**8))
if not (n.count('0') or t_mod(mpz(n), sum((mpz(d) for d in n)))
or t_mod(mpz(n), reduce(mul, (mpz(d) for d in n))))]+
[mpz(n) for n in (str(x)+str(x)[-2::-1] for x in range(10**8))
if not (n.count('0') or t_mod(mpz(n), sum((mpz(d) for d in n)))
or t_mod(mpz(n), reduce(mul, (mpz(d) for d in n))))])
# Chai Wah Wu, Aug 25 2014
A334528
Palindromic numbers that are also Niven numbers and Smith numbers.
Original entry on oeis.org
4, 666, 28182, 45054, 51315, 82628, 239932, 454454, 864468, 2594952, 2976792, 3189813, 3355533, 4172714, 4890984, 5319135, 5367635, 5777775, 7149417, 7247427, 8068608, 8079708, 8100018, 8280828, 8627268, 9227229, 9423249, 21699612, 22544522, 24166142, 27677672
Offset: 1
666 is a term since it is palindromic, a Niven number (6 + 6 + 6 = 18 is a divisor of 666) and a Smith number (666 = 2 * 3 * 3 * 37 and 6 + 6 + 6 = 2 + 3 + 3 + 3 + 7).
-
digSum[n_] := Plus @@ IntegerDigits[n]; palNivenSmithQ[n_] := PalindromeQ[n] && Divisible[n, (ds = digSum[n])] && CompositeQ[n] && Plus @@ (Last@# * digSum[First@#] & /@ FactorInteger[n]) == ds; Select[Range[10^5], palNivenSmithQ]
A334529
Numbers that are both binary palindromes and binary Niven numbers.
Original entry on oeis.org
1, 21, 273, 4161, 22517, 28347, 65793, 69905, 81913, 87381, 106483, 109483, 121143, 292721, 299593, 317273, 319449, 350933, 354101, 368589, 378653, 421811, 470951, 479831, 1049601, 1135953, 1171313, 1172721, 1208009, 1257113, 1269593, 1295481, 1332549, 1371877
Offset: 1
21 is a term since its binary representation, 10101, is palindromic, and 1 + 0 + 1 + 0 + 1 = 3 is a divisor of 21.
-
Select[Range[10^6], PalindromeQ[(d = IntegerDigits[#, 2])] && Divisible[#, Plus @@ d] &]
-
def ok(n): b = bin(n)[2:]; return b==b[::-1] and n%sum(map(int, b)) == 0
def aupto(nn): return [m for m in range(1, nn+1) if ok(m)]
print(aupto(1371877)) # Michael S. Branicky, Jan 21 2021
Showing 1-3 of 3 results.
Comments