OFFSET
2,3
REFERENCES
Bela Bajnok, Additive Combinatorics: A Menu of Research Problems, Manuscript, May 2017. See Table in Section 1.6.1.
A. P. Street, Counting non-isomorphic sum-free sets, in Proc. First Australian Conf. Combinatorial Math., Univ. Newcastle, 1972, pp. 141-143.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 2..10000
Bela Bajnok, Additive Combinatorics: A Menu of Research Problems, arXiv:1705.07444 [math.NT], May 2017. See Table in Section 1.6.1.
Ben Green and Imre Z. Ruzsa, Sum-free sets in abelian groups, arXiv:math/0307142 [math.CO], 2004.
FORMULA
If n is divisible by a prime == 2 mod 3 then a(n) = n(p+1)/(3p) where p is the smallest such prime divisor; otherwise if n is divisible by 3 then a(n) = n/3; otherwise all prime divisors of n are == 1 mod 3 and a(n) = (n-1)/3.
In particular, a(2n) = n (cf. A211317).
MATHEMATICA
a[n_] := Module[{f = FactorInteger[n][[All, 1]]}, For[i = 1, i <= Length[f], i++, If[Mod[f[[i]], 3]==2, Return[n*(f[[i]] + 1)/3/f[[i]]]]]; If[Mod[n, 3] == 1, n-1, n]/3]
Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Aug 02 2018, from PARI *)
PROG
(Haskell)
a211316 n | not $ null ps = n * (head ps + 1) `div` (3 * head ps)
| m == 0 = n'
| otherwise = (n - 1) `div` 3
where ps = [p | p <- a027748_row n, mod p 3 == 2]
(n', m) = divMod n 3
-- Reinhard Zumkeller, Apr 25 2012
(PARI) a(n)=my(f=factor(n)[, 1]); for(i=1, #f, if(f[i]%3==2, return(n*(f[i]+1)/3/f[i]))); if(n%3, n-1, n)/3 \\ Charles R Greathouse IV, Sep 02 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Apr 24 2012
STATUS
approved
