login
Nonsquares with last digit in {0, 1, 4, 5, 6, 9}.
1

%I #35 Oct 31 2024 01:09:18

%S 5,6,10,11,14,15,19,20,21,24,26,29,30,31,34,35,39,40,41,44,45,46,50,

%T 51,54,55,56,59,60,61,65,66,69,70,71,74,75,76,79,80,84,85,86,89,90,91,

%U 94,95,96,99,101,104,105,106,109,110,111,114,115,116,119,120,124,125

%N Nonsquares with last digit in {0, 1, 4, 5, 6, 9}.

%C Squares have the last digit in {0, 1, 4, 5, 6, 9}, but the reverse is not always true since there are nonsquares that end with a digit in the same set. See Beiler.

%D Albert H. Beiler, Recreations in the theory of numbers, New York, Dover, (2nd ed.) 1966. See p. 139.

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

%p remove(issqr, [seq(seq(10*a+b,b=[0,1,4,5,6,9]),a=0..20)]); # _Robert Israel_, Oct 30 2024

%t Select[Range[0,125],!IntegerQ[Sqrt[#]]&&MemberQ[{0,1,4,5,6,9},Last[IntegerDigits[#]]] &]

%o (Python)

%o from math import isqrt

%o def ok(n): return n%10 in {0, 1, 4, 5, 6, 9} and isqrt(n)**2 < n

%o print([k for k in range(126) if ok(k)]) # _Michael S. Branicky_, Aug 04 2024

%Y Intersection of A000037 and A008854.

%Y Cf. A000290.

%K nonn,base,easy

%O 1,1

%A _Stefano Spezia_, Aug 04 2024