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.
%I A131097 #17 Feb 16 2025 08:33:06 %S A131097 1,2,1,2,2,4,1,2,4,2,4,1,4,2,4,2,4,4,1,4,2,6,4,2,4,4,1,4,4,2,6,4,2,8, %T A131097 4,4,1,4,4,2,8,6,4,2,8,4,4,10,1,4,4,2,8,6,4,10,2,8,4,4,10,1,4,4,8,2,8, %U A131097 6,4,10,2,8,4,10,4,10,1,4,4,8,2,8,6,16,4,10,2,8,4,10,4 %N A131097 Sum of digits of 3-smooth numbers in ternary representation. %C A131097 a(n) = A053735(A003586(n)); values are even iff greater than 1. %H A131097 Robert Israel, <a href="/A131097/b131097.txt">Table of n, a(n) for n = 1..10000</a> %H A131097 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DigitSum.html">Digit Sum</a> %H A131097 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Ternary.html">Ternary</a> %p A131097 Res:= NULL: N:= 10^6: %p A131097 for a from 0 to ilog2(N) do %p A131097 for b from 0 do %p A131097 v:= 2^a*3^b; %p A131097 if v > N then break fi; %p A131097 Res:= Res, v; %p A131097 od od: %p A131097 TS:= sort([Res]): %p A131097 map(t -> convert(convert(t,base,3),`+`), TS); # _Robert Israel_, Oct 08 2018 %o A131097 (Python) %o A131097 from sympy import integer_log %o A131097 from sympy.ntheory import digits %o A131097 def A131097(n): %o A131097 def bisection(f,kmin=0,kmax=1): %o A131097 while f(kmax) > kmax: kmax <<= 1 %o A131097 kmin = kmax >> 1 %o A131097 while kmax-kmin > 1: %o A131097 kmid = kmax+kmin>>1 %o A131097 if f(kmid) <= kmid: %o A131097 kmax = kmid %o A131097 else: %o A131097 kmin = kmid %o A131097 return kmax %o A131097 def f(x): return n+x-sum((x//3**i).bit_length() for i in range(integer_log(x,3)[0]+1)) %o A131097 return sum(digits(bisection(f,n,n),3)[1:]) # _Chai Wah Wu_, Jan 31 2025 %K A131097 nonn,base,look %O A131097 1,2 %A A131097 _Reinhard Zumkeller_, Jun 14 2007