login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A354721
Absolute values of first differences of A354687.
4
1, 2, 4, 6, 8, 3, 9, 10, 12, 5, 15, 14, 18, 16, 20, 39, 13, 22, 33, 21, 27, 24, 11, 26, 28, 23, 46, 48, 7, 30, 34, 32, 49, 35, 36, 51, 45, 42, 25, 44, 55, 38, 66, 19, 57, 40, 87, 58, 54, 102, 52, 56, 50, 68, 85, 62, 60, 75, 65, 63, 108, 69, 64, 70, 72, 141, 17, 74, 88, 76, 78, 148, 80, 91, 77, 81
OFFSET
1,2
COMMENTS
See A354687 for further details.
LINKS
Michael De Vlieger, Annotated log log scatterplot of a(n), n = 1..2^14, showing records in red and local minima in blue, highlighting primes in green and fixed points in gold.
Scott R. Shannon, Image of the first 100000 terms. The green line is y = n.
EXAMPLE
a(5) = 8 as | A354687(6) - A354687(5) | = | 6 - 14 | = 8.
MATHEMATICA
nn = 120; c[_] = d[_] = 0; a[1] = c[1] = 1; a[2] = c[2] = j = 2; u = 3; {1}~Join~Reap[Do[Set[k, u]; While[Nand[c[k] == 0, d[Abs[k - j]] == 0, ! CoprimeQ[j, k]], k++]; Set[{a[i], c[k], d[Abs[k - j]]}, {k, i, i}]; Sow[Abs[k - j]]; j = k; If[k == u, While[c[u] > 0, u++]], {i, 3, nn}]][[-1, -1]] (* Michael De Vlieger, Jun 04 2022 *)
PROG
(Python)
from math import gcd
from sympy import isprime, nextprime
from itertools import count, islice
def agen(): # generator of terms
aset, diffset, an, mink = {1, 2}, {1}, 2, 3
yield from [1]
for n in count(3):
k = mink
while k in aset or abs(an-k) in diffset or gcd(an, k) == 1: k += 1
aset.add(k); diffset.add(abs(k-an)); yield abs(an-k); an = k
while mink in aset: mink += 1
print(list(islice(agen(), 76))) # Michael S. Branicky, Jun 04 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Jun 04 2022
STATUS
approved