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.

A046864 Smallest number whose digits sum to n-th prime.

This page as a plain text file.
%I A046864 #19 Nov 01 2015 09:05:25
%S A046864 2,3,5,7,29,49,89,199,599,2999,4999,19999,59999,79999,299999,899999,
%T A046864 5999999,7999999,49999999,89999999,199999999,799999999,2999999999,
%U A046864 8999999999,79999999999,299999999999,499999999999,899999999999
%N A046864 Smallest number whose digits sum to n-th prime.
%C A046864 Every term a(n), except for 3, has the form i9...9 with k >= 0 nines, where i = 1, 2, 4, 5, 7 or 8. Indeed, {1,2,4,5,7,8} are all digits respectively prime to 9. Therefore, every prime, except for p=3, is in one of the progressions i + 9*k. On the other hand, to reach prime(n) using other digits, we need a greater number of them, which contradicts the minimality of a(n). - _Vladimir Shevelev_, May 07 2013
%e A046864 E.g. 599 -> 5 + 9 + 9 = prime 23.
%t A046864 sn[n_, k_] := Nest[FromDigits[Flatten[IntegerDigits[{#, 9}]]] &, n, k]; Join[Prime[Range[4]], Table[p = Prime[n]; sn[Mod[p, 9], Quotient[p, 9]], {n, 5, 28}]] (* _Jayanta Basu_, Jun 29 2013 *)
%o A046864 (PARI) a(n) = {my(k=1); my(p=prime(n)); while (sumdigits(k) != p, k++); k;} \\ _Michel Marcus_, Nov 01 2015
%K A046864 nonn,base,easy
%O A046864 1,1
%A A046864 _Patrick De Geest_, Oct 15 1999