login
This sequence, the sequence of first differences and the sequence of partial sums, are disjoint; a(0) = 1.
2

%I #10 Jul 19 2016 15:37:24

%S 1,3,8,14,21,30,40,52,65,80,96,113,131,150,170,193,217,242,268,295,

%T 323,352,383,415,448,482,518,555,593,632,673,715,758,802,847,893,940,

%U 988,1037,1087,1140,1194,1249,1306,1362,1420,1479,1539,1600,1662,1725,1789

%N This sequence, the sequence of first differences and the sequence of partial sums, are disjoint; a(0) = 1.

%e If first row gives the sums and the third row the differences, then:

%e .4 11 22 35 51 70 92 117 145

%e 1 3 8 14 21 30 40 52 65 80 ... [this sequence]

%e .2 5 6 7 9 10 12 13 15

%o (PLT Scheme)

%o (define (element? item a-list)

%o (ormap (lambda (i) (equal? item i)) a-list))

%o (define (A098762 n seq bad ops)

%o (local ((define newbads (map (lambda (op) (op n (first seq))) ops))

%o (define (ok? n)

%o (and (not (element? n bad))

%o (not (ormap (lambda (x) (element? x bad)) newbads))

%o (not (ormap (lambda (x) (element? x seq)) newbads)))))

%o (cond

%o [(> n 10000) (reverse seq)]

%o [(ok? n) (A098762 (add1 n) (cons n seq) (append newbads bad) ops)]

%o [else (A098762 (add1 n) seq bad ops)])))

%o (A098762 2 (list 1) empty (list + -))

%o ;; _Joshua Zucker_, Jul 27 2006

%Y Cf. A098763.

%K easy,nonn

%O 0,2

%A _Eric Angelini_, Oct 01 2004

%E Better definition from _Joshua Zucker_, Jul 27 2006