login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A058359 Absolute value of difference between the even and odd first differences of the divisors of n. 1

%I

%S 0,1,2,1,4,5,6,5,8,9,10,5,12,13,14,13,16,17,18,5,20,21,22,17,24,25,26,

%T 5,28,17,30,29,32,33,34,17,36,37,38,29,40,41,42,5,44,45,46,41,48,49,

%U 50,5,52,53,54,45,56,57,58,33,60,61,62,61,64,65,66,5,68,57,70,57,72,73,74

%N Absolute value of difference between the even and odd first differences of the divisors of n.

%H Robert Israel, <a href="/A058359/b058359.txt">Table of n, a(n) for n = 1..10000</a>

%e The divisors of twelve are {1, 2, 3, 4, 6 and 12}, the first difference is {1, 1, 1, 2 and 6}. The even differences add up to 8 while the odd differences add up to 3. The absolute difference between the even and odd first differences of 12 therefore is 5.

%p f:= proc(n) local Q, evens,odds;

%p Q:= sort(convert(numtheory:-divisors(n),list));

%p evens,odds:= selectremove(type,Q[2..-1]-Q[1..-2],even);

%p abs(convert(evens,`+`)-convert(odds,`+`))

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, Jul 05 2016

%t f[ n_Integer ] := (d = Divisors[ n ]; l = Length[ d ]; s = 0; i = 1; While[ i < l, e = d[ [ i + 1 ] ] - d[ [ i ] ]; If[ EvenQ[ e ], s = s + e, s = s - e ]; i++ ]; Abs[ s ]); Table[ f[ n ], {n, 1, 75} ]

%t avd[n_]:=Module[{d=Differences[Divisors[n]]},Abs[Total[Select[d,OddQ]]-Total[ Select[ d,EvenQ]]]]; Array[avd,80] (* _Harvey P. Dale_, Dec 31 2018 *)

%K nonn

%O 1,3

%A _Robert G. Wilson v_, Dec 16 2000

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 14 09:14 EDT 2020. Contains 336480 sequences. (Running on oeis4.)