A115751 a(1)=1. a(n) = number of positive divisors of n which are not among the first (n-1) terms of the sequence.
1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 4, 1, 2, 3, 2, 1, 3, 1, 3, 2, 2, 1, 4, 2, 2, 2, 3, 1, 5, 1, 3, 2, 2, 2, 5, 1, 2, 2, 4, 1, 5, 1, 3, 3, 2, 1, 6, 2, 3, 2, 3, 1, 4, 2, 5, 2, 2, 1, 6, 1, 2, 4, 4, 2, 4, 1, 3, 2, 5, 1, 7, 1, 2, 3, 3, 2, 4, 1, 6, 3, 2, 1, 6, 2, 2, 2, 5, 1, 7, 2, 3, 2, 2, 2, 7, 1, 3, 4, 5, 1, 4, 1, 5, 4
Offset: 1
Keywords
Examples
The divisors of 12 are 1, 2, 3, 4, 6 and 12. Of these, only the four divisors 3, 4, 6 and 12 do not occur among the first 11 terms of the sequence. So a(12) = 4.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..10001
Crossrefs
Cf. A088167.
Programs
-
Maple
with(numtheory): a[1]:=1: for n from 2 to 120 do div:=divisors(n): M:=convert([seq(a[j],j=1..n-1)],set): a[n]:=nops(div minus M): od: seq(a[n],n=1..120); # Emeric Deutsch, Apr 01 2006
-
Scheme
;; We define a mutual recurrence with the memoization-macro definec: (definec (A115751 n) (if (= 1 n) n (length (remove (lambda (d) (zero? (modulo (Aauxseq_forA115751 (- n 1)) (A000040 d)))) (divisors n))))) ;; The other member of the mutual recurrence has not been submitted. Its n-th term keeps track in its prime factorization what distinct values has so far occurred in A115751(1) .. A115751(n). That is, iff value k has occurred in range a(1) .. a(n), then the n-th term of this auxiliary sequence is divisible by the k-th prime: (definec (Aauxseq_forA115751 n) (if (= 1 n) 2 (lcm (A000040 (A115751 n)) (Aauxseq_forA115751 (- n 1))))) (define (divisors n) (cons 1 (proper-divisors n))) (define (proper-divisors n) (let loop ((k n) (divs (list))) (cond ((= 1 k) divs) ((zero? (modulo n k)) (loop (- k 1) (cons k divs))) (else (loop (- k 1) divs))))) ;; Antti Karttunen, Oct 21 2017
Extensions
More terms from Emeric Deutsch, Apr 01 2006
Comments