login
a(n+1) = a(n) + (final digit of greatest prime < a(n)); a(1)=3.
1

%I #31 Aug 14 2019 01:48:25

%S 3,5,8,15,18,25,28,31,40,47,50,57,60,69,76,79,82,91,100,107,110,119,

%T 122,125,128,135,136,137,138,145,154,155,156,157,158,165,168,175,178,

%U 181,190,191,192,193,194,197,200,209,218,219,220,221,222,223,224,227,230,239,242,243,244,245,246,247,248,249,250,251,252

%N a(n+1) = a(n) + (final digit of greatest prime < a(n)); a(1)=3.

%C Let a(n) be composite, and gp(n) be the greatest prime less than a(n), with final digit d(n). Then sp(n), the smallest prime greater than a(n) is in the sequence if and only if d(n) divides (sp(n) - a(n)), in which case (sp(n) - a(n))/d(n) is the integer m, and a(n + m) = sp(n).

%C If a(n) is prime, with final digit d'(n) then sp(n) (the next prime after a(n)) is in the sequence if and only if sp(n) = a(n)+ d(n) + r * d'(n) for some r >= 1, in which case

%C a(n + r + 1) = sp(n).

%C Primes appearing in the sequence are 3, 5, 31, 47, 79, 107, 137, 157, 181, 191, 193, 197, ... If a prime occurs at a(n), a(n+2) = a(n+1) + d(n) only if there is no prime between a(n) and a(n+1).

%C Primes in the sequence whose final digit is not contributed to a subsequent term include 3, 5, 31, 107, 197, ...

%C Primes not appearing in the sequence but which contribute a final digit include 2, 7, 13, 17, 23, 29, 37, ...

%H Robert Israel, <a href="/A290630/b290630.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n+1) = a(n) + d(n) where d(n) = A007652(gp(n)); gp(n) = greatest prime < a(n).

%e a(2) = a(1) + gp(1) = 3 + 2 = 5.

%e a(59) = 242 (composite), gp(59) = 241, and d(59) = 1. sp(59) = 251 is in the sequence because (sp(59) - a(59))/d(59) = (251 - 242)/1 = 9 (= m). Therefore a(59 + 9) = a(68) = 251.

%e a(40) = 181 (prime), d'(40) = 1, gp(40) = 179, d(40) = 9. Then sp(40) = 191 is in the sequence because with r = 1,

%e a(40) + d(40) + r*d'(40) = 181 + 9 + 1*1 = 191 = a(40+1+1) = a(42).

%p A[1]:= 3:

%p for i from 2 to 100 do

%p A[i]:= A[i-1] + (prevprime(A[i-1]) mod 10)

%p od:

%p seq(A[i],i=1..100); # _Robert Israel_, Aug 13 2019

%t NestList[# + Mod[NextPrime[#, -1], 10] &, 3, 68] (* _Michael De Vlieger_, Aug 19 2017 *)

%o (PARI) lista(nn) = {print1(a = 3, ", "); for (n=2, nn, a = a + precprime(a-1) % 10; print1(a, ", "););} \\ _Michel Marcus_, Aug 19 2017

%Y Cf. A000040, A007652.

%K nonn,base

%O 1,1

%A _David James Sycamore_, Aug 07 2017