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.
%I A112877 #31 Mar 10 2024 12:09:43 %S A112877 117,199,381,427,521,721,1151,1997,3625,6607,12269,23209,41133,75441, %T A112877 141209,266969,507701,968373,1851971,3549473,6817481,13115259, %U A112877 25267949,48750929,94173137,182122379,352587759,683348381,1325663485,2419811401,4551835269,8705190801,16798251617,32575310493 %N A112877 Zeros in Cald's sequence: positions k such that A006509(k) = 0. %e A112877 A006509(117) = 0 and A006509(k) > 0 for k < 117, so a(1) = 117. %t A112877 a[1] = 1; a[n_] := a[n] = Block[{b = a[n - 1], p = Prime[n - 1]}, If[ b - p > 0 && Position[t, b - p] == {}, b - p, If[ Position[t, b + p] == {}, b + p, 0]]]; t = {1}; Do[ AppendTo[t, a[n]], {n, 2, 270000}]; Flatten[ Position[t, 0]] (* _Robert G. Wilson v_, Oct 29 2005 *) %o A112877 (Python) %o A112877 from itertools import count, islice %o A112877 from sympy import nextprime %o A112877 def A112877_gen(): # generator of terms %o A112877 a, aset, p = 1, {1}, 2 %o A112877 for c in count(2): %o A112877 if (b:=a-p) > 0 and b not in aset: %o A112877 a = b %o A112877 elif (b:=a+p) not in aset: %o A112877 a = b %o A112877 else: %o A112877 a = 0 %o A112877 yield c %o A112877 aset.add(a) %o A112877 p = nextprime(p) %o A112877 A112877_list = list(islice(A112877_gen(),10)) # _Chai Wah Wu_, Mar 04 2024 %Y A112877 Cf. A006509, A112878, A117128, A117129. %Y A112877 A370951 gives first differences. %K A112877 nonn %O A112877 1,1 %A A112877 _Klaus Brockhaus_, Oct 24 2005 %E A112877 a(15) and a(16) from _Robert G. Wilson v_, Oct 29 2005 %E A112877 a(17) and a(18) from _Klaus Brockhaus_, Jan 01 2006 %E A112877 a(19)-a(26) from _Donovan Johnson_, Feb 18 2010 %E A112877 a(27)-a(29) from _Chai Wah Wu_, Mar 04 2024 %E A112877 a(30)-a(34) from _Martin Ehrenstein_, Mar 07 2024 (see A370951) %E A112877 More than the usual number of terms are shown in order to include the new terms from A370951. - _N. J. A. Sloane_, Mar 10 2024