login
Numbers that contain primes to odd powers only.
(Formerly M0614 N0224)
17

%I M0614 N0224 #51 Feb 16 2024 01:20:13

%S 2,3,5,6,7,8,10,11,13,14,15,17,19,21,22,23,24,26,27,29,30,31,32,33,34,

%T 35,37,38,39,40,41,42,43,46,47,51,53,54,55,56,57,58,59,61,62,65,66,67,

%U 69,70,71,73,74,77,78,79,82,83,85,86,87,88,89,91,93,94,95,96,97,101

%N Numbers that contain primes to odd powers only.

%C Complement of the union of {1} and A072587. - _Reinhard Zumkeller_, Nov 15 2012, corrected version from Jun 23 2002

%C A036537 is a subsequence and this sequence is a subsequence of A162644. - _Reinhard Zumkeller_, Jul 08 2009

%C The asymptotic density of this sequence is A065463. - _Amiram Eldar_, Sep 18 2022

%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H T. D. Noe, <a href="/A002035/b002035.txt">Table of n, a(n) for n = 1..1000</a>

%H Eckford Cohen, <a href="http://www.jstor.org/stable/2313545">Quadratic congruences with an odd number of summands</a>, Amer. Math. Monthly, 73 (1966), 138-143.

%p isA002035 := proc(n)

%p local pe;

%p for pe in ifactors(n)[2] do

%p if type(pe[2],'even') then

%p return false;

%p end if;

%p end do:

%p true ;

%p end proc:

%p A002035 := proc(n)

%p option remember;

%p if n =1 then

%p 2;

%p else

%p for a from procname(n-1)+1 do

%p if isA002035(a) then

%p return a;

%p end if;

%p end do:

%p end if;

%p end proc:

%p seq(A002035(n),n=1..100) ; # _R. J. Mathar_, Nov 27 2017

%t ok[n_] := And @@ OddQ /@ FactorInteger[n][[All, 2]];

%t Select[Range[2, 101], ok]

%t (* _Jean-François Alcover_, Apr 22 2011 *)

%t Select[Range[2,110],AllTrue[FactorInteger[#][[All,2]],OddQ]&] (* _Harvey P. Dale_, Nov 02 2022 *)

%o (Haskell)

%o a002035 n = a002035_list !! (n-1)

%o a002035_list = filter (all odd . a124010_row) [1..]

%o -- _Reinhard Zumkeller_, Nov 14 2012

%o (PARI) is(n)=Set(factor(n)[,2]%2)==[1] \\ _Charles R Greathouse IV_, Feb 07 2017

%Y Cf. A000203, A036537, A065463, A072586, A072587, A124010, A162644, A188999, A295316.

%K nonn,nice

%O 1,1

%A _N. J. A. Sloane_

%E More terms from _Reinhard Zumkeller_, Jun 23 2002