A378505 a(0) = 0, a(n) = 0 where a(n-1) is nonzero and divisible by n. Otherwise a(n) = n + a(n-1).
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
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)
Links
- Paolo Xausa, Table of n, a(n) for n = 0..10000
- 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.
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
Comments