|
|
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
|
|
|
EXAMPLE
|
Beginning with prime(5) = 11: 11-9 = 2, 13-9 = 4, 17-15 = 2, 19-15 = 4.
|
|
MAPLE
|
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:
# second Maple program:
a:= n-> `if`(isprime(ithprime(n)-2), 4, 2):
|
|
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
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|