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.

A330492 a(n) = sum of second differences of the sorted divisors of n.

This page as a plain text file.
%I A330492 #34 Apr 06 2021 06:01:51
%S A330492 0,0,1,0,2,0,3,4,4,0,5,0,6,8,7,0,8,0,9,12,10,0,11,16,12,16,13,0,14,0,
%T A330492 15,20,16,24,17,0,18,24,19,0,20,0,21,28,22,0,23,36,24,32,25,0,26,40,
%U A330492 27,36,28,0,29,0,30,40,31,48,32,0,33,44,34,0,35,0,36
%N A330492 a(n) = sum of second differences of the sorted divisors of n.
%C A330492 The sums of the first differences of the divisors of n are given by the sequence b(n) = n - 1.
%C A330492 Let the set {D(i)} = {d(i + 1) - d(i)} where the d(i) are the divisors of an integer m listed in ascending order with i = 1, 2 , ..., tau(n)-1. The sequence is given by a(n) = Sum_{k = 1..tau(n)-2} (D(k + 1) - D(k)).
%H A330492 Antti Karttunen, <a href="/A330492/b330492.txt">Table of n, a(n) for n = 2..8191</a>
%H A330492 Antti Karttunen, <a href="/A330492/a330492.txt">Data supplement: n, a(n) computed for n = 2..65537</a>
%F A330492 a(n) = d(tau(n)) - d(tau(n) - 1) + d(1) - d(2) where d(i) are the divisors of n.
%F A330492 a(prime(n)) = 0 and a(2k) = k-1, k = 1, 2, ...
%F A330492 a(p^2) = (p-1)^2 if p prime, with the generalization a(p^m) = (p-1)(p^(m-1) - 1).
%F A330492 a(n) = (n/p-1)*(p-1), where p is the least prime factor of n. - _Nathaniel Gregg_, Apr 04 2021
%e A330492 a(12) = 5 because the divisors of 12 are {1, 2, 3, 4, 6, 12} and {D(i)} = {d(i+1)-d(i)} ={1, 1, 1, 2, 6}, Sum_{D(i), i = 1..4} {D(i+1)-D(i)} = 0 + 0 + 1 + 4 = 5.
%p A330492 with(numtheory):nn:=100:
%p A330492 for n from 2 to nn do:
%p A330492 d:=divisors(n):n0:=nops(d):T:=array(1..n0-1,[0$n0-1]):
%p A330492   for j from 1 to n0-1 do:
%p A330492    T[j]:=d[j+1]-d[j]:
%p A330492   od:
%p A330492    s:=sum(ā€˜T[i+1]-T[i] ’,ā€˜i’=1..n0-2): printf(`%d, `,s):
%p A330492 od:
%p A330492 *** alternative program using the formula ***
%p A330492 with(numtheory):nn:=100:
%p A330492 for n from 2 to nn do:
%p A330492 d:=divisors(n):t:=tau(n):s:=d[t]-d[t-1]+d[1]-d[2] :
%p A330492   printf(`%d, `,s):
%p A330492 od:
%t A330492 Array[Total@ Differences[Divisors@ #, 2] &, 73, 2] (* _Michael De Vlieger_, Dec 16 2019 *)
%o A330492 (PARI) a(n) = my(d=divisors(n)); d[#d] - d[#d-1] + d[1] - d[2]; \\ _Michel Marcus_, Feb 05 2020
%o A330492 (Python)
%o A330492 from sympy import primefactors
%o A330492 def a(n): p = primefactors(n)[0]; return (n//p - 1) * (p - 1)
%o A330492 print([a(n) for n in range(2, 75)]) # _Michael S. Branicky_, Apr 04 2021
%Y A330492 Cf. A000005, A027750, A036263, A193829.
%K A330492 nonn
%O A330492 2,5
%A A330492 _Michel Lagneau_, Dec 16 2019