# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a352952 Showing 1-1 of 1 %I A352952 #13 Jun 04 2022 13:58:50 %S A352952 3,5,7,13,19,31,43,73,103,109,211,313,523,733,751,1483,1693,1801,2551, %T A352952 4243,6793,9343,10093,10303,12853,14653,17203,19753,22303,24103,25903, %U A352952 26113,28663,28771,54673,83443,112213,140983,169753,171553,200323,229093,257863 %N A352952 a(1) = 3; a(2) = 5; a(n+1) = a(n) + b(n), where b(n) = max {a(n-1)+-1, a(n-2)+-1, a(n-3)+-1, ..., a(1)+-1} such that a(n) + b(n) is a prime. %C A352952 This sequence is finite and has 111 terms, which are given in the b-file. %C A352952 a(n) == 1 (mod 6) if n > 2. For n = 3 or > 4, b(n) = a(n-i) - 1, where 1 < b < n. %H A352952 Ya-Ping Lu, Table of n, a(n) for n = 1..111 %e A352952 For n = 6, the first 6 terms are [3, 5, 7, 13, 19, 31] and, in the list [19+-1, 13+-1, 7+-1, 5+-1, 3+-1], 13-1 is the largest number that gives a prime when added to a(6). Thus, b(6) = 13 - 1 = 12 and b(7) = a(6) + b(6) = 43. %o A352952 (Python) %o A352952 from sympy import isprime; L = [3, 5] %o A352952 while 1: %o A352952 for j in range(2, len(L)+1): %o A352952 s = L[-1] + L[-j] %o A352952 if isprime(s+1): L.append(s+1); break %o A352952 elif isprime(s-1): L.append(s-1); break %o A352952 else: break %o A352952 print(*L, sep = ', ') %Y A352952 Cf. A337347. %K A352952 fini,nonn,full %O A352952 1,1 %A A352952 _Ya-Ping Lu_, Apr 10 2022 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE