The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 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. 1
 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 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 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). LINKS Antti Karttunen, Table of n, a(n) for n = 1..100000 PROG (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]; CROSSREFS Cf. also A001359 (positions of 3's), A305801, A319704, A331304, A336852, A336853. Sequence in context: A323373 A332826 A319350 * A329895 A342552 A078908 Adjacent sequences:  A336852 A336853 A336854 * A336856 A336857 A336858 KEYWORD nonn AUTHOR Antti Karttunen, Aug 09 2020 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 14 00:42 EDT 2021. Contains 342941 sequences. (Running on oeis4.)