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.

A050220 Larger of Smith brothers.

This page as a plain text file.
%I A050220 #35 Feb 16 2025 08:32:40
%S A050220 729,2965,3865,4960,5936,6188,9387,9634,11696,13765,16537,16592,20785,
%T A050220 25429,28809,29624,32697,33633,35806,39586,43737,44734,49028,55345,
%U A050220 56337,57664,58306,62635,65913,65975,66651,67068,67729,69280,69836,73616,73617,74169
%N A050220 Larger of Smith brothers.
%H A050220 Amiram Eldar, <a href="/A050220/b050220.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Robert Israel)
%H A050220 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/SmithBrothers.html">Smith Brothers</a>.
%p A050220 issmith:= proc(n)
%p A050220   if isprime(n) then return false fi;
%p A050220   convert(convert(n,base,10),`+`) = add(t[2]*convert(convert(t[1],base,10),`+`),t=ifactors(n)[2])
%p A050220 end proc:
%p A050220 S:= select(issmith, {$4..10^5}):
%p A050220 sort(convert(S intersect map(`+`,S,1), list)); # _Robert Israel_, Jan 15 2018
%t A050220 smithQ[n_] := n > 1 && !PrimeQ[n] && Total[Flatten[IntegerDigits[Table[#[[1]], {#[[2]]}]& /@ FactorInteger[n]]]] == Total[IntegerDigits[n]];
%t A050220 Select[Range[10^5], smithQ[#] && smithQ[#-1]&] (* _Jean-François Alcover_, Jun 07 2020 *)
%o A050220 (PARI) isone(n) = {if (!isprime(n), f = factor(n); sumdigits(n) == sum(k=1, #f~, f[k,2]*sumdigits(f[k,1])););}
%o A050220 isok(n) =  isone(n) && isone(n-1); \\ _Michel Marcus_, Jul 17 2015
%o A050220 (Python)
%o A050220 from sympy import factorint
%o A050220 from itertools import count, islice
%o A050220 def sd(n): return sum(map(int, str(n)))
%o A050220 def smith():
%o A050220     for k in count(1):
%o A050220         f = factorint(k)
%o A050220         if sum(f[p] for p in f) > 1 and sd(k) == sum(sd(p)*f[p] for p in f):
%o A050220             yield k
%o A050220 def agen():
%o A050220     prev = -1
%o A050220     for s in smith():
%o A050220         if s == prev + 1: yield s
%o A050220         prev = s
%o A050220 print(list(islice(agen(), 38))) # _Michael S. Branicky_, Dec 23 2022
%Y A050220 Cf. A006753, A050219.
%K A050220 nonn,base
%O A050220 1,1
%A A050220 _Eric W. Weisstein_
%E A050220 Offset corrected by _Arkadiusz Wesolowski_, May 08 2012