login
Numbers with property that their divisors are odd, even, odd, even, and so on.
3

%I #43 Jul 10 2016 11:18:03

%S 1,2,6,10,14,18,22,26,34,38,42,46,50,54,58,62,66,74,78,82,86,94,98,

%T 102,106,110,114,118,122,130,134,138,142,146,158,162,166,170,174,178,

%U 186,190,194,202,206,214,218,222,226,230,238,242,246,250,254,258,262

%N Numbers with property that their divisors are odd, even, odd, even, and so on.

%C Are there terms that are not congruent to 2 (mod 4) for n > 1?

%C Answer from _R. J. Mathar_, Jul 21 2013: (Start)

%C For an odd number C to be in the sequence, the divisors must be odd, even, odd,..,odd. So only C=1 is possible, because odd numbers do not have even divisors. This excludes numbers ==1 (mod 4) and == 3 (mod 4) from the sequence (with 1 the only exception).

%C If some number C (a candidate for the sequence) is a multiple of 4, C=4*k, it surely has divisors {1, 2, 3, 4 , ..., k, ..., 2k, 4k} because 1, 2 and 4 are divisors (also 3 sandwiched between 2 and 4). The two largest divisors would be 2k and 4k, both even, and this violates the odd-even rule. So no C ==0 (mod 4) exists in the sequence, and the sequence contains 1 plus a subsequence of A016825.

%C (End)

%H Reinhard Zumkeller, <a href="/A182991/b182991.txt">Table of n, a(n) for n = 1..10000</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Table_of_divisors">Table of divisors</a>

%e 18 is in the sequence because its divisors are 1, 2, 3, 6, 9, 18 and then we can see that 1 is odd, 2 is even, 3 is odd, 6 is even, 9 is odd and 18 is even.

%t OddEvenQ[a_List] := Module[{b = Mod[a, 2]}, Union[b[[1 ;; ;; 2]]] == {1} && Union[b[[2 ;; ;; 2]]] == {0}]; Join[{1}, Select[Range[2, 400], OddEvenQ[Divisors[#]] &]] (* _T. D. Noe_, Aug 04 2011 *)

%t oeQ[n_]:=Module[{c=Boole[OddQ[Divisors[n]]]},c==PadRight[{},Length[c],{1,0}]]; Select[Range[300],oeQ] (* _Harvey P. Dale_, Jul 10 2016 *)

%o (Haskell)

%o a182991 n = a182991_list !! (n-1)

%o a182991_list = filter f [1..] where

%o f x = all (== 1) $ zipWith (+) dps $ tail dps where

%o dps = map (flip mod 2) $ a027750_row' x

%o -- _Reinhard Zumkeller_, Jun 23 2015, Aug 04 2011

%o (PARI) isok(n) = my(d = divisors(n)) ; sum(i=1, #d, (d[i]%2) == (i%2)) == #d; \\ _Michel Marcus_, May 18 2014

%Y Cf. A182996, A183147.

%Y Cf. A027750.

%K nonn,easy

%O 1,2

%A _Omar E. Pol_, Aug 04 2011