cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A104171 Reversible Smith numbers, i.e., Smith numbers whose reversal is also a Smith number.

This page as a plain text file.
%I A104171 #20 Mar 14 2025 11:03:51
%S A104171 4,22,58,85,121,202,265,319,454,535,562,636,666,913,1111,1507,1642,
%T A104171 1881,1894,1903,2461,2583,2605,2614,2839,3091,3663,3852,4162,4198,
%U A104171 4369,4594,4765,4788,4794,4954,4974,4981,5062,5386,5458,5539,5674,5818,5926,6295
%N A104171 Reversible Smith numbers, i.e., Smith numbers whose reversal is also a Smith number.
%C A104171 The palindromic Smith numbers (A098834) are a subset of the reversible Smith numbers.
%H A104171 Amiram Eldar, <a href="/A104171/b104171.txt">Table of n, a(n) for n = 1..10000</a>
%H A104171 Shyam Sunder Gupta, <a href="http://www.shyamsundergupta.com/smith.htm">Smith Numbers</a>.
%H A104171 Shyam Sunder Gupta, <a href="https://doi.org/10.1007/978-981-97-2465-9_4">Smith Numbers</a>, Exploring the Beauty of Fascinating Numbers, Springer (2025) Ch. 4, 127-157.
%e A104171 a(3) = 58 because 58 and its reverse 85 are Smith numbers.
%t A104171 rev[n_] := FromDigits @ Reverse @ IntegerDigits[n]; digSum[n_] := Plus @@ IntegerDigits[n]; smithQ[n_] := CompositeQ[n] && Plus @@ (Last@#*digSum[First@#] & /@ FactorInteger[n]) == digSum[n]; Select[Range[6000], smithQ[#] && smithQ @ rev[#] &] (* _Amiram Eldar_, Aug 24 2020 *)
%o A104171 (Python)
%o A104171 from sympy import factorint
%o A104171 def sd(n): return sum(map(int, str(n)))
%o A104171 def smith(n):
%o A104171   f = factorint(n)
%o A104171   return sum(f[p] for p in f) > 1 and sd(n) == sum(sd(p)*f[p] for p in f)
%o A104171 def ok(n): return smith(n) and smith(int(str(n)[::-1]))
%o A104171 print(list(filter(ok, range(6296)))) # _Michael S. Branicky_, Apr 22 2021
%Y A104171 Cf. A006753, A098834.
%K A104171 nonn,base
%O A104171 1,1
%A A104171 _Shyam Sunder Gupta_, Mar 10 2005