%I #87 Jun 20 2023 15:00:16
%S 1,2,3,5,6,7,10,11,13,14,15,16,17,19,21,22,23,26,29,30,31,32,33,34,35,
%T 37,38,39,41,42,43,46,47,48,51,53,55,57,58,59,61,62,65,66,67,69,70,71,
%U 73,74,77,78,79,80,81,82,83,85,86,87,89,91,93,94,95,96,97
%N Numbers with an odd number of square divisors.
%C Open lockers in the locker problem where the student numbers are the set of perfect squares.
%C The locker problem is a classic mathematical problem. Imagine a row containing an infinite number of lockers numbered from one to infinity. Also imagine an infinite number of students numbered from one to infinity. All of the lockers begin closed. The first student opens every locker that is a multiple of one, which is every locker. The second student closes every locker that is a multiple of two, so all of the even-numbered lockers are closed. The third student opens or closes every locker that is a multiple of three. This process continues for all of the students. [This is sometimes called the light switch problem - see A360845.]
%C A variant on the locker problem is when not all student numbers are considered; in the case of this sequence, only the square-numbered students open and close lockers. The sequence here is a list of the open lockers after all of the students have gone.
%C n is in the sequence if and only if it is the product of a squarefree number (A005117) and a fourth power (A000583). - _Robert Israel_, Apr 07 2015
%C Let D be the multiset containing d0(k), the divisor counting function, for each divisor k of n. n is in the sequence if and only if D admits a partition into two parts A and B such that the sum of the elements of A is exactly one more or less than the sum of the elements of B. For example, if n = 80, we have D = {1, 2, 2, 3, 4, 4, 5, 6, 8, 10}, and A = {1, 2, 3, 4, 4, 8} and B = {2, 5, 6, 10}. The sum of A is 22, and the sum of B is 23. - _Griffin N. Macris_, Oct 10 2016
%C From _Amiram Eldar_, Jul 07 2020: (Start)
%C Numbers k such that the largest square dividing k (A008833) is a fourth power.
%C The asymptotic density of this sequence is Pi^2/15 = A182448 = 0.657973... (Cesàro, 1885). (End)
%C Closed under the binary operation A059897(.,.), forming a subgroup of the positive integers under A059897. - _Peter Munn_, Aug 01 2020
%H Reinhard Zumkeller, <a href="/A252895/b252895.txt">Table of n, a(n) for n = 1..10000</a>
%H Ernest Cesàro, <a href="https://doi.org/10.1007/BF02420801">Le plus grand diviseur carré</a>, Annali di Matematica Pura ed Applicata, Vol. 13, No. 1 (1885), pp. 251-268, <a href="https://iris.univ-lille.fr/handle/1908/1932">entire volume</a>.
%H K. A. P. Dagal, <a href="http://arxiv.org/abs/1307.6455">Generalized Locker Problem</a>, arXiv:1307.6455 [math.NT], 2013.
%H B. Torrence and S. Wagon, <a href="https://cms.math.ca/crux/v33/n4/page232-236.pdf">The Locker Problem</a>, Crux Mathematicorum, 2007, 33(4), 232-236.
%e The set of divisors of 6 is {1,2,3,6}, which contains only one perfect square: 1; therefore 6 is a term.
%e The set of divisors of 16 is {1,2,4,8,16}, which contains three perfect squares: 1, 4, and 16; therefore 16 is a term.
%e The set of divisors of 4 is {1,2,4}, which contains two perfect squares: 1 and 4; therefore 4 is not a term.
%p N:= 1000: # to get all terms <= N
%p S:= select(numtheory:-issqrfree, {$1..N}):
%p map(s -> seq(s*i^4, i = 1 .. floor((N/s)^(1/4))), S);
%p # if using Maple 11 or earlier, uncomment the next line
%p # sort(convert(%,list)); # _Robert Israel_, Apr 07 2015
%t Position[Length@ Select[Divisors@ #, IntegerQ@ Sqrt@ # &] & /@ Range@ 70, _Integer?OddQ] // Flatten (* _Michael De Vlieger_, Mar 23 2015 *)
%t a[n_] := DivisorSigma[0, Total[EulerPhi/@Select[Sqrt[Divisors[n]], IntegerQ]]]; Flatten[Position[a/@Range@100,_?OddQ]] (* _Ivan N. Ianakiev_, Apr 07 2015 *)
%t Select[Range@ 100, OddQ@ Length@ DeleteCases[Divisors@ #, k_ /; ! IntegerQ@ Sqrt@ k] &] (* _Michael De Vlieger_, Oct 10 2016 *)
%o (C++)
%o #include <iostream>
%o using namespace std;
%o int main()
%o {
%o const int one_k = 1000;
%o //all numbers in sequence up to one_k are given
%o int lockers [one_k] = {};
%o int A = 0;
%o while (A < one_k) {
%o lockers [A] = A+1;
%o A = A + 1;
%o }
%o int B = 1;
%o while ( ((B) * (B)) <= one_k) {
%o int C = ((B) * (B));
%o int D = one_k/C;
%o int E = 1;
%o while (E <= D) {
%o lockers [(C*E)-1] = -1 * lockers [(C*E)-1];
%o E = E + 1;
%o }
%o B = B + 1;
%o }
%o int F = 0;
%o while (F < one_k) {
%o if (lockers [F] < 0) {
%o cout << (-1 * lockers [F]) << endl;
%o }
%o F = F + 1;
%o }
%o return 0;
%o } // _Walker Dewey Anderson_, Mar 22 2015
%o (PARI) isok(n) = sumdiv(n, d, issquare(d)) % 2; \\ _Michel Marcus_, Mar 22 2015
%o (Sage) [n for n in [1..200] if len([x for x in divisors(n) if is_square(x)])%2==1] # _Tom Edgar_, Mar 22 2015
%o (Haskell)
%o a252895 n = a252895_list !! (n-1)
%o a252895_list = filter (odd . a046951) [1..]
%o -- _Reinhard Zumkeller_, Apr 06 2015
%Y Cf. A000290, A000583, A005117, A008833, A046951, A182448, A252849, A360845.
%Y Positions of ones in A335324.
%K nonn
%O 1,2
%A _Walker Dewey Anderson_, Mar 22 2015