OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(1) = a(2) = 4. For n >= 3, a(n) = A014683(n).
MAPLE
# This Maple program returns the smallest composite greater than n - N. J. A. Sloane, Sep 11 2019
iscomp := n-> if isprime(n) or (n=1) then false else true; fi;
f := proc(n) local a; global iscomp; a:=n+1; while not iscomp(a) do a:=a+1; od; a; end;
MATHEMATICA
Table[k = n; While[! CompositeQ@ k, k++]; k, {n, 72}] (* Michael De Vlieger, Sep 06 2017 *)
PROG
(Haskell)
a113646 n = if n < 3 then 4 else a014683 n
-- Reinhard Zumkeller, Nov 01 2014
(Python)
from sympy import isprime
def a(n):
an = max(4, n)
while isprime(an): an += 1
return an
print([a(n) for n in range(1, 73)]) # Michael S. Branicky, Apr 04 2021
(Python)
from sympy import isprime
def A113646(n): return n+isprime(n) if n>2 else 4 # Chai Wah Wu, Oct 03 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Jan 15 2006
STATUS
approved