A370951 First differences of A112877 (zero terms in Cald's sequence A006509).
82, 182, 46, 94, 200, 430, 846, 1628, 2982, 5662, 10940, 17924, 34308, 65768, 125760, 240732, 460672, 883598, 1697502, 3268008, 6297778, 12152690, 23482980, 45422208, 87949242, 170465380, 330760622, 642315104, 1094147916, 2132023868, 4153355532, 8093060816, 15777058876
Offset: 1
Keywords
Programs
-
Mathematica
nn = 2^20; c[_] := False; a[1] = j = 1; c[1] = True; Differences@ Monitor[Reap[ Do[p = Prime[n - 1]; If[And[# > 0, ! c[#]], k = #, If[c[#], k = 0; Sow[n], k = #] &[j + p]] &[j - p]; Set[{c[k], j}, {True, k}], {n, 2, nn}]][[-1, 1]], n] (* Michael De Vlieger, Mar 07 2024 *)
-
Python
from itertools import count, islice from sympy import nextprime def A370951_gen(): # generator of terms a, aset, p, q = 1, {1}, 2, 0 for c in count(2): if (b:=a-p) > 0 and b not in aset: a = b elif (b:=a+p) not in aset: a = b else: a = 0 if q: yield c-q q = c aset.add(a) p = nextprime(p) A370951_list = list(islice(A370951_gen(),10)) # Chai Wah Wu, Mar 07 2024
Extensions
a(29)-a(33) from Martin Ehrenstein, Mar 07 2024
Comments