cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A378505 a(0) = 0, a(n) = 0 where a(n-1) is nonzero and divisible by n. Otherwise a(n) = n + a(n-1).

Original entry on oeis.org

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

Views

Author

Stuart Coe, Nov 29 2024

Keywords

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: (Start)
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)

Examples

			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)
		

Crossrefs

Cf. A068627, A379013 (positions of zeros).

Programs

  • 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 *)
  • PARI
    \\ See Corneth link
  • 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