login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A095248
a(n) = least k > 0 such that n-th partial sum is divisible by n if and only if n is not prime.
1
1, 2, 1, 4, 1, 3, 1, 3, 2, 2, 1, 3, 1, 3, 2, 2, 1, 3, 1, 3, 2, 2, 1, 3, 2, 2, 2, 2, 1, 3, 1, 3, 2, 2, 2, 2, 1, 3, 2, 2, 1, 3, 1, 3, 2, 2, 1, 3, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 1, 3, 1, 3, 2, 2, 2, 2, 1, 3, 2, 2, 1, 3, 1, 3, 2, 2, 2, 2, 1, 3, 2, 2, 1, 3, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 2, 1, 3, 2, 2, 1, 3, 1, 3, 2
OFFSET
1,2
LINKS
EXAMPLE
n = 1 is not prime, k = 1 results in first partial sum 1 divisible by 1 as required, so a(1) = 1.
n = 2 is prime, k = 1 results in second partial sum 2 divisible by 2 and is excluded, but k = 2 results in second partial sum 3 not divisible by 2 as required, so a(2) = 2.
PROG
(PARI) {m=105; s=0; for(n=1, m, k=1; if(isprime(n), while((s+k)%n==0, k++), while((s+k)%n>0, k++)); print1(k, ", "); s=s+k)}
CROSSREFS
Sequence in context: A124331 A242885 A181157 * A122458 A329644 A256578
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Jun 17 2004
EXTENSIONS
Edited and extended by Klaus Brockhaus, Jun 19 2004
STATUS
approved