cp's OEIS Frontend

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.

A336855 Lexicographically earliest infinite sequence such that a(i) = a(j) => f(i) = f(j), for all i, j >= 1, where f(p) = p-nextprime(p) for primes p, and f(n) = n for all other numbers.

Original entry on oeis.org

1, 2, 3, 4, 3, 5, 6, 7, 8, 9, 3, 10, 6, 11, 12, 13, 3, 14, 6, 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, 24, 18, 25, 26, 27, 28, 29, 6, 30, 31, 32, 3, 33, 6, 34, 35, 36, 18, 37, 38, 39, 40, 41, 18, 42, 43, 44, 45, 46, 3, 47, 18, 48, 49, 50, 51, 52, 6, 53, 54, 55, 3, 56, 18, 57, 58, 59, 60, 61, 6, 62, 63, 64, 18, 65, 66
Offset: 1

Views

Author

Antti Karttunen, Aug 09 2020

Keywords

Comments

Restricted growth sequence transform of function f defined as: f(n) = -{distance to the next larger prime} when n is a prime, otherwise f(n) = -n.
For all i, j:
a(i) = a(j) => A305801(i) = A305801(j),
a(i) = a(j) => A336852(i) = A336852(j),
a(i) = a(j) => A336853(i) = A336853(j).

Crossrefs

Cf. also A001359 (positions of 3's), A305801, A319704, A331304, A336852, A336853.

Programs

  • PARI
    up_to = 100000;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A336855aux(n) = if(isprime(n),n-nextprime(1+n),n);
    v336855 = rgs_transform(vector(up_to,n,A336855aux(n)));
    A336855(n) = v336855[n];