login
A081650
Least nonsquare whose remainder modulo k^2 is a square for all 0 < k <= n.
2
2, 5, 13, 73, 409, 801, 1584, 2241, 30601, 30601, 78409, 156825, 862416, 862416, 7929009, 28173825, 196668004, 196668004
OFFSET
1,1
COMMENTS
See A260709 for the (maybe more natural) variant of squares (mod k^2) instead of remainders equal to a square. - M. F. Hasler, Nov 17 2015
REFERENCES
Mark A. Herkommer, Number Theory, A Programmer's Guide, McGraw-Hill, New York, 1999, page 315.
EXAMPLE
a(3) = 13 because for (mod 1) (A000037) is the set of all nonsquares, for (mod 4) (A079896) is the set beginning {5, 8, 12, 13, 17, 20, 21, 24, 28, 29, ...} and for (mod 9) (A081642) is the set beginning {10, 13, 18, 19, 22, 27, 28, 31, 37, 40, ...}. The first element of the intersection of these three sets is 13.
MAPLE
M:= 0:
for m from 2 while M < 15 do
if (not issqr(m)) and andmap(issqr, [seq(m mod k^2, k=1..M+1)]) then
A[M+1]:= m;
for k from M+2 while issqr(m mod k^2) do A[k]:= m od:
M:= k-1;
fi
od:
seq(A[m], m=1..15); # Robert Israel, Nov 17 2015
PROG
(PARI) t=2; for(n=1, 50, for(m=t, 10^9, if(issquare(m), next); f=0; for(k=1, n, if(!issquare(m % k^2), f=1; break)); if(!f, print1(m", "); t=m; break)))
From M. F. Hasler, Nov 17 2015: (Start)
(PARI) A081650(n, t=2)=for(m=t, 9e9, issquare(m)&&next; for(k=1, n, issquare(m%k^2)||next(2)); return(m)) \\ The 2nd optional arg allows us to give a lower search limit, useful since a(n+1) >= a(n) by definition: see usage below.
(PARI) t=2; for(n=1, 50, print1(t=A081650(n, t), ", ")) \\ (End)
(MATLAB)
N = 10^8; % to get all terms <= N
B = ones(1, N);
B([1:floor(sqrt(N))].^2) = 0;
m = 1;
while true
nsq = ones(m^2, 1);
nsq([1:m].^2)=0;
S = nsq * ones(1, ceil(N/m^2));
S = reshape(S, 1, numel(S));
B(S(1:N)>0) = 0;
v = find(B, 1, 'first');
if numel(v) == 0
break
end
A(m) = v;
m = m + 1;
end
A % Robert Israel, Nov 17 2015
KEYWORD
nonn,more
AUTHOR
Robert G. Wilson v, Mar 26 2003
EXTENSIONS
Edited by Ralf Stephan, Mar 27 2003
Definition corrected and original PARI code updated by M. F. Hasler, Nov 17 2015
a(16) to a(18) from Robert Israel, Nov 17 2015
STATUS
approved