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 A336409 #23 Oct 05 2020 02:41:43 %S A336409 2,4,2,4,2,2,4,2,2,4,2,2,2,4,2,2,4,2,2,2,2,2,4,2,4,2,2,2,2,4,2,4,2,2, %T A336409 2,2,2,4,2,4,2,4,2,2,2,4,2,2,4,2,2,2,2,4,2,2,4,2,2,2,4,2,2,2,2,4,2,2, %U A336409 2,2,2,2,2,2,2,2,2,4,2,4,2,2,2,2,2,4 %N A336409 Distance from prime(n) to the nearest odd composite that is < prime(n). %F A336409 a(n) = 2 * A175191(n-1). - _Alois P. Heinz_, Oct 02 2020 %F A336409 a(n) = 2 * (A062301(n) + 1). - _Hugo Pfoertner_, Oct 02 2020 %e A336409 Beginning with prime(5) = 11: 11-9 = 2, 13-9 = 4, 17-15 = 2, 19-15 = 4. %p A336409 A336409 := proc(n) %p A336409 local p; %p A336409 p := ithprime(n) ; %p A336409 for a from p-2 by -2 do %p A336409 if not isprime(a) then %p A336409 return p-a ; %p A336409 end if; %p A336409 end do: %p A336409 end proc: %p A336409 seq(A336409(n),n=5..100) ; # _R. J. Mathar_, Oct 02 2020 %p A336409 # second Maple program: %p A336409 a:= n-> `if`(isprime(ithprime(n)-2), 4, 2): %p A336409 seq(a(n), n=5..100); # _Alois P. Heinz_, Oct 02 2020 %t A336409 z = 5000; d = Select[Range[2, z], ! PrimeQ@# && OddQ@# &]; (* A014076 *) %t A336409 f[n_] := Select[d, # < Prime[n] &]; %t A336409 t = Table[Prime[n] - Max[f[n]], {n, 5, 300}] (* A336409 *) %t A336409 Flatten[Position[t, 2]] (* A336410 *) %t A336409 Flatten[Position[t, 4]] (* A336411 *) %Y A336409 Cf. A175191, A014076, A336410, A336411, A062301. %K A336409 nonn %O A336409 5,1 %A A336409 _Clark Kimberling_, Sep 06 2020