login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A336409 Distance from prime(n) to the nearest odd composite that is < prime(n). 3
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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 2, 2, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
5,1
LINKS
FORMULA
a(n) = 2 * A175191(n-1). - Alois P. Heinz, Oct 02 2020
a(n) = 2 * (A062301(n) + 1). - Hugo Pfoertner, Oct 02 2020
EXAMPLE
Beginning with prime(5) = 11: 11-9 = 2, 13-9 = 4, 17-15 = 2, 19-15 = 4.
MAPLE
A336409 := proc(n)
local p;
p := ithprime(n) ;
for a from p-2 by -2 do
if not isprime(a) then
return p-a ;
end if;
end do:
end proc:
seq(A336409(n), n=5..100) ; # R. J. Mathar, Oct 02 2020
# second Maple program:
a:= n-> `if`(isprime(ithprime(n)-2), 4, 2):
seq(a(n), n=5..100); # Alois P. Heinz, Oct 02 2020
MATHEMATICA
z = 5000; d = Select[Range[2, z], ! PrimeQ@# && OddQ@# &]; (* A014076 *)
f[n_] := Select[d, # < Prime[n] &];
t = Table[Prime[n] - Max[f[n]], {n, 5, 300}] (* A336409 *)
Flatten[Position[t, 2]] (* A336410 *)
Flatten[Position[t, 4]] (* A336411 *)
CROSSREFS
Sequence in context: A165464 A308658 A158137 * A010694 A111737 A056672
KEYWORD
nonn
AUTHOR
Clark Kimberling, Sep 06 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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 25 11:50 EDT 2024. Contains 375438 sequences. (Running on oeis4.)