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.

A060712 Smallest number whose sum of digits is 3^n.

This page as a plain text file.
%I A060712 #24 Mar 27 2025 21:31:21
%S A060712 1,3,9,999,999999999,999999999999999999999999999,
%T A060712 999999999999999999999999999999999999999999999999999999999999999999999999999999999
%N A060712 Smallest number whose sum of digits is 3^n.
%H A060712 Harry J. Smith, <a href="/A060712/b060712.txt">Table of n, a(n) for n = 0..8</a>
%F A060712 a(n) = A051885(3^n). - _Andrew Howroyd_, Dec 08 2024
%F A060712 a(n) = 10^(3^(n-2)) - 1 for n > 1. - _Stefano Spezia_, Mar 27 2025
%t A060712 Do[ a = {}; While[ Apply[ Plus, a ] + 9 < 3^n, a = Append[ a, 9 ] ]; If[ Apply[ Plus, a ] != 3^n, a = Prepend[ a, 3^n - Apply[ Plus, a ] ] ]; Print[ FromDigits[ a ] ], {n, 1, 6} ]
%t A060712 Join[{1,3},Table[FromDigits[PadRight[{},3^(n-2),9]],{n,2,6}]] (* _Harvey P. Dale_, Jun 10 2015 *)
%o A060712 (PARI) a(n)={ my(s=3^n, x=s\9, d=s-9*x); (d+1)*10^x - 1 } \\ _Harry J. Smith_, Jul 10 2009
%Y A060712 Cf. A051885.
%K A060712 nonn,base
%O A060712 0,2
%A A060712 _Robert G. Wilson v_, Apr 21 2001