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”).

A378505
a(0) = 0, a(n) = 0 where a(n-1) is nonzero and divisible by n. Otherwise a(n) = n + a(n-1).
2
0, 1, 3, 0, 4, 9, 15, 22, 30, 39, 49, 60, 0, 13, 27, 42, 58, 75, 93, 112, 132, 153, 175, 198, 222, 247, 273, 300, 328, 357, 387, 418, 450, 483, 517, 552, 588, 625, 663, 0, 40, 81, 123, 166, 210, 255, 301, 348, 396, 445, 495, 546, 598, 651, 705, 760, 816
OFFSET
0,3
COMMENTS
From Robert Israel, Nov 29 2024: (Start)
There are an infinite number of zeros in the sequence. If not, suppose a(m) was the last one. Then for j > m, we would have a(j-1) = (m+1) + (m+2) + ... + (j-1) = (j+m)*(j-m-1)/2. In particular, a(m*(m+1)-1) = (m-1)*m*(m+1)*(m+2)/2, which is divisible by m*(m+1) since m-1 or m+2 is even, and that would mean a(m*(m+1)) = 0, contradiction. (End)
From David A. Corneth, Nov 30 2024:
For some z_0 > 0 such that a(z_0) = 0 we can find the next z_1 > z_0 such that a(z_1) = 0 but for any z_0 < t < z_1 we have a(t) > 0. Then a(t) = binomial(t+1, 2) - binomial(z0+1, 2). Since a(z_1) = 0 we have z_1 | (binomial(z_1 -1 +1, 2) - binomial(z0+1, 2)) = z_1 * (z_1 - 1) / 2 - z_0 * (z_0 + 1)/2.
This means z_1 | 2*(z_1 * (z_1 - 1) / 2 - z_0 * (z_0 + 1)/2) = (z_1 * (z_1 - 1) - z_0 * (z_0 + 1)) where (z_1 * (z_1 - 1) - z_0 * (z_0 + 1)) > 0. As z_1 | z_1 * (z_1 - 1) we also have z_1 | (z_0 * (z_0 + 1)). By the proof of Robert Israel above such z_1 must exist. (End)
LINKS
David A. Corneth, PARI programs
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^20, showing a(n) = 0 instead as 1/2 for visibility.
EXAMPLE
a(11) = 49 + 11 = 60, since a(10) = 49, which does not exactly divide by 11.
a(12) = 0, since a(11) = 60, a nonzero number that exactly divides by 12.
a(13) = 0 + 13 = 13, since a(12) = 0 (so is not nonzero).
From David A. Corneth, Nov 30 2024: (Start) The next 0 after n = 12 is a divisor of 12 * (12 + 1) = 156. The divisors of 156 that are larger than 12 + 1 = 13 are 26, 39, 52, 78, 156. Of these, 39 is the smallest z_1 such that z_1 | z_1 * (z_1 - 1) / 2 - z_0 * (z_0 + 1)/2. Therefore the next 0 after n = 12 is at n = 39.
The first few zeros are at 0, 3, 12, 39, 65, 78, 158, 237, ... (= A379013). As 100 is between the consecutive zeros 78 and 158 there is no zero strictly between 78 and 158 and so a(100) = 100*(100+1) / 2 - 78*(78+1)/2 = 1969. (End)
MAPLE
a:= proc(n) option remember; `if`(n=0, 0, (t->
`if`(t>0 and irem(t, n)=0, 0, t+n))(a(n-1)))
end:
seq(a(n), n=0..56); # Alois P. Heinz, Nov 29 2024
MATHEMATICA
Module[{n = 0}, NestList[If[Divisible[#, ++n] && # > 0, 0, # + n] &, 0, 100]] (* Paolo Xausa, Dec 09 2024 *)
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
an = 0
for n in count(1):
yield an
an = 0 if an > 0 and an%n == 0 else an + n
print(list(islice(agen(), 70))) # Michael S. Branicky, Nov 29 2024
(PARI) \\ See Corneth link
CROSSREFS
Cf. A068627, A379013 (positions of zeros).
Sequence in context: A374966 A309764 A079406 * A068627 A357884 A074171
KEYWORD
nonn,easy,look,new
AUTHOR
Stuart Coe, Nov 29 2024
STATUS
approved