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.

A268605 a(1) = 0; a(n+1) is the smallest integer in which the difference between its digits sum and the a(n) digits sum is equal to the n-th prime.

This page as a plain text file.
%I A268605 #45 Jun 25 2025 10:16:30
%S A268605 0,2,5,19,89,1999,59999,4999999,599999999,199999999999,
%T A268605 399999999999999,799999999999999999,8999999999999999999999,
%U A268605 499999999999999999999999999,29999999999999999999999999999999,4999999999999999999999999999999999999
%N A268605 a(1) = 0; a(n+1) is the smallest integer in which the difference between its digits sum and the a(n) digits sum is equal to the n-th prime.
%C A268605 First 8 terms are primes (and are also in A061248). Next terms are not always primes.
%H A268605 Francesco Di Matteo, <a href="/A268605/b268605.txt">Table of n, a(n) for n = 1..25</a>
%F A268605 a(n) = A051885( A007504(n-1) ). - _R. J. Mathar_, Jun 19 2021
%e A268605 a(4) = 19 and 1 + 9 = 10; so a(5) = 89 because 8 + 9 = 17 and 17 - 10 = 7, that is the 4th prime.
%o A268605 (Python)
%o A268605 sumprime = 0
%o A268605 isPrime=lambda x: all(x % i != 0 for i in range(int(x**0.5)+1)[2:])
%o A268605 print(0)
%o A268605 for i in range(2,100):
%o A268605   if isPrime(i):
%o A268605     alfa = ""
%o A268605     k = i + sumprime
%o A268605     sumprime = k
%o A268605     while k > 9:
%o A268605       alfa = alfa + "9"
%o A268605       k = k - 9
%o A268605     alfa = str(k)+alfa
%o A268605     print(alfa)
%o A268605 (PARI) findnext(x, k) = {sx = sumdigits(x); pk = prime(k); y = 1; while (sumdigits(y) - sx != pk, y++); y;}
%o A268605 lista(nn) = {print1(x = 0, ", "); for (k=1, nn, y = findnext(x, k); print1(y, ", "); x = y;);} \\ _Michel Marcus_, Feb 19 2016
%Y A268605 Cf. A269306, A061248, A067180, A051885.
%K A268605 nonn,base
%O A268605 1,2
%A A268605 _Francesco Di Matteo_, Feb 17 2016
%E A268605 NAME adapted to offset by _R. J. Mathar_, Jun 19 2021