OFFSET
1,3
EXAMPLE
a(7)=10 because the 7th composite is 14 and its remainders modulo 1, 2, 3, 4, 5, 6, 7 are 0, 0, 2, 2, 4, 2, 0 respectively and 0 + 0 + 2 + 2 + 4 + 2 + 0 = 10.
MAPLE
A002808 := proc(n) local a; if n = 1 then 4; else for a from procname(n-1)+1 do if not isprime(a) then RETURN(a) ; end if; end do; end if; end proc: A162733 := proc(n) local c; c := A002808(n) ; add(c mod k, k=1..n) ; end: seq(A162733(n), n=1..80) ; # R. J. Mathar, Aug 01 2009
MATHEMATICA
composite[n_] := FixedPoint[n + PrimePi[#] + 1 &, n + PrimePi[n] + 1];
a[n_] := Total[Mod[composite[n], #]& /@ Range[n]];
Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Jul 23 2024 *)
PROG
(PARI) n=3; for(k=1, 100, n++; n+=isprime(n); print1(sum(i=1, k, n%i)", ")) \\ Franklin T. Adams-Watters, Aug 06 2009
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Jul 13 2009
EXTENSIONS
Corrected and extended by R. J. Mathar and Franklin T. Adams-Watters, Aug 01 2009
STATUS
approved