login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 2

%I #37 Jun 19 2021 10:33:14

%S 0,2,5,19,89,1999,59999,4999999,599999999,199999999999,

%T 399999999999999,799999999999999999,8999999999999999999999,

%U 499999999999999999999999999,29999999999999999999999999999999,4999999999999999999999999999999999999

%N 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 First 8 terms are primes (and are also in A061248). Next terms are not always primes.

%H Francesco Di Matteo, <a href="/A268605/b268605.txt">Table of n, a(n) for n = 1..25</a>

%F a(n) = A051885( A007504(n-1) ).- _R. J. Mathar_, Jun 19 2021

%e 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 (Python)

%o sumprime = 0

%o isPrime=lambda x: all(x % i != 0 for i in range(int(x**0.5)+1)[2:])

%o for i in range(2,100):

%o ..if isPrime(i):

%o ....alfa = ""

%o ....k = i + sumprime

%o ....sumprime = k

%o ....while k > 9:

%o ......alfa = alfa + "9"

%o ......k = k - 9

%o ....alfa = str(k)+alfa

%o ....print alfa

%o (PARI) findnext(x, k) = {sx = sumdigits(x); pk = prime(k); y = 1; while (sumdigits(y) - sx != pk, y++); y;}

%o lista(nn) = {print1(x = 0, ", "); for (k=1, nn, y = findnext(x, k); print1(y, ", "); x = y;);} \\ _Michel Marcus_, Feb 19 2016

%Y Cf. A269306, A061248, A067180, A051885.

%K nonn,base

%O 1,2

%A _Francesco Di Matteo_, Feb 17 2016

%E NAME adapted to offset. - _R. J. Mathar_, Jun 19 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 18:04 EDT 2024. Contains 371254 sequences. (Running on oeis4.)