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.

Original entry on oeis.org

2, 3, 5, 7, 29, 49, 89, 199, 599, 2999, 4999, 19999, 59999, 79999, 299999, 899999, 5999999, 7999999, 49999999, 89999999, 199999999, 799999999, 2999999999, 8999999999, 79999999999, 299999999999, 499999999999, 899999999999
Offset: 1

Views

Author

Patrick De Geest, Oct 15 1999

Keywords

Comments

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

Examples

			E.g. 599 -> 5 + 9 + 9 = prime 23.
		

Programs

  • Mathematica
    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 *)
  • PARI
    a(n) = {my(k=1); my(p=prime(n)); while (sumdigits(k) != p, k++); k;} \\ Michel Marcus, Nov 01 2015