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.

A368241 a(n) = n - prevprime(n) if n is prime, n + primepi(n) otherwise; a(2) = 2.

This page as a plain text file.
%I A368241 #49 Jan 31 2024 07:57:54
%S A368241 1,2,1,6,2,9,2,12,13,14,4,17,2,20,21,22,4,25,2,28,29,30,4,33,34,35,36,
%T A368241 37,6,40,2,43,44,45,46,47,6,50,51,52,4,55,2,58,59,60,4,63,64,65,66,67,
%U A368241 6,70,71,72,73,74,6,77,2,80,81,82,83,84,6,87,88,89,4,92,2,95,96
%N A368241 a(n) = n - prevprime(n) if n is prime, n + primepi(n) otherwise; a(2) = 2.
%C A368241 prevprime(n) = A151799(n) is the largest prime < n.
%C A368241 a(n) = 2 iff n=2 or n is the larger prime of a twin prime pair (A006512).
%t A368241 Table[If[n<3, n, If[PrimeQ[n], n-NextPrime[n,-1], n+PrimePi[n]]],{n,75}] (* _James C. McMahon_, Dec 19 2023 *)
%o A368241 (PARI) a(n) = if (isprime(n), n - precprime(n-1), n + primepi(n)); \\ _Michel Marcus_, Dec 18 2023
%Y A368241 Cf. A000720, A005171, A010051, A006512, A095117, A151799.
%Y A368241 Cf. A368196 (trajectories).
%K A368241 nonn,easy
%O A368241 1,2
%A A368241 _Hendrik Kuipers_, Dec 18 2023