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.

A329814 The smallest base b where the sum of the digits for the number n in the base b is the smallest, with 1 < b < n and a(1) = a(2) = 1.

Original entry on oeis.org

1, 1, 2, 2, 2, 2, 6, 2, 3, 2, 10, 2, 12, 7, 14, 2, 2, 2, 18, 2, 20, 11, 22, 2, 5, 5, 3, 3, 28, 3, 30, 2, 2, 2, 34, 6, 6, 19, 38, 2, 40, 6, 42, 22, 44, 23, 46, 2, 7, 5, 50, 26, 52, 3, 54, 7, 56, 29, 58, 30, 60, 31, 62, 2, 2, 2, 66, 2, 68, 35, 70, 2, 72, 37, 74
Offset: 1

Views

Author

Haris Ziko, Nov 21 2019

Keywords

Comments

The smallest sum of digits corresponding to a(n) is equal to 2-A075802(n), i.e., it is 1 when n is 1 or a perfect power and 2 otherwise. - Giovanni Resta, Nov 22 2019
a(n)=n-1 if and only if n is in A088905 but not in A001597. a(n)<= n/2 if n is even. - Robert Israel, Dec 05 2019

Examples

			For n = 5:
  n in base 2 = [1, 0, 1] -> digitSum(5, 2) = 2.
  n in base 3 = [1, 2] -> digitSum(5, 3) = 3.
  n in base 4 = [1, 1] -> digitSum(5, 4) = 2.
  Base 2 has the smallest sum of the digits for n = 5 ->
    therefore a(5) = 2.
For n = 7:
  n in base 2 = [1, 1, 1] -> digitSum(7, 2) = 3.
  n in base 3 = [2, 1] -> digitSum(7, 3) = 3.
  n in base 4 = [1, 3] -> digitSum(7, 4) = 4.
  n in base 5 = [1, 2] -> digitSum(7, 5) = 3.
  n in base 6 = [1, 1] -> digitSum(7, 6) = 2.
  Base 6 has the smallest sum of the digits for n = 7 ->
    therefore a(7) = 6.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local F, t,d,bmin,s,r,b;
       F:= ifactors(n)[2];
       d:= igcd(seq(t[2],t=F));
       if d > 1 then return mul(t[1]^(t[2]/d),t=F) fi;
       F:= ifactors(n-1)[2];
       d:= igcd(seq(t[2],t=F));
       if d=1 then bmin:= n-1 else bmin:= mul(t[1]^(t[2]/d),t=F) fi;
       for s in numtheory:-divisors(n) do
         r:= n/s-1;
         F:= ifactors(s)[2];
         d:= igcd(seq(t[2],t=F));
         b:= mul(t[1]^(t[2]/d),t=F);
         if b < bmin and r = b^padic:-ordp(r,b) then bmin:= b fi
       od;
       bmin;
    end proc:
    map(f, [$1..100]); # Robert Israel, Dec 05 2019
  • Mathematica
    a[n_] := Block[{b=1, r=n, t}, Do[t = Plus @@ IntegerDigits[n, i]; If[t < r, r=t; b=i], {i, 2, n-1}]; b]; Array[a, 75] (* Giovanni Resta, Nov 22 2019 *)
  • PARI
    a(n)={my(best_b=1, best_dig_sum=n); if(n>1, for(b=2, n-1, dig_sum=sumdigits(n, b); if(best_dig_sum>dig_sum, best_dig_sum=dig_sum; best_b=b))); best_b};

Extensions

More terms from Giovanni Resta, Nov 22 2019