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 A336855 #7 Aug 10 2020 00:19:40 %S A336855 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, %T A336855 23,3,24,18,25,26,27,28,29,6,30,31,32,3,33,6,34,35,36,18,37,38,39,40, %U A336855 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 %N 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. %C A336855 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. %C A336855 For all i, j: %C A336855 a(i) = a(j) => A305801(i) = A305801(j), %C A336855 a(i) = a(j) => A336852(i) = A336852(j), %C A336855 a(i) = a(j) => A336853(i) = A336853(j). %H A336855 Antti Karttunen, <a href="/A336855/b336855.txt">Table of n, a(n) for n = 1..100000</a> %H A336855 <a href="/index/Pri#gaps">Index entries for primes, gaps between</a> %o A336855 (PARI) %o A336855 up_to = 100000; %o A336855 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; }; %o A336855 A336855aux(n) = if(isprime(n),n-nextprime(1+n),n); %o A336855 v336855 = rgs_transform(vector(up_to,n,A336855aux(n))); %o A336855 A336855(n) = v336855[n]; %Y A336855 Cf. also A001359 (positions of 3's), A305801, A319704, A331304, A336852, A336853. %K A336855 nonn %O A336855 1,2 %A A336855 _Antti Karttunen_, Aug 09 2020