

A162157


Number of square numbers from 1 to n^2 where all decimal digits are at most the corresponding digit of n^2.


1



1, 2, 3, 3, 3, 5, 7, 3, 2, 1, 3, 5, 12, 11, 6, 10, 16, 5, 4, 2, 5, 12, 11, 16, 9, 18, 13, 13, 6, 3, 9, 3, 11, 10, 8, 17, 20, 10, 5, 3, 10, 15, 24, 17, 5, 5, 5, 4, 4, 3, 7, 10, 13, 14, 6, 12, 19, 11, 9, 5, 11, 21, 52, 11, 11, 21, 40, 15, 14, 7, 2, 10, 18, 30, 23, 45, 37, 7, 5, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Proof that 1, 2, 3, and 7 are the only values for which a(n)=n. For any n >= 3, n^2 must end in 9 for a(n) to equal n, and so n must end in 3 or 7. a(13) is only 12 because of 81 having a nexttolast digit greater than 6 (from 169). a(17) is only 17 because of 196 having a nexttolast digit greater than 8 (from 289.) Similarly, for any n > 14 to have a(n) equal n, n^2 has to end in 99, for which no square number does. Therefore 1, 2, 3, and 7 are the only values for which a(n) = n.


LINKS

Michael De Vlieger, Table of n, a(n) for n = 1..10000


EXAMPLE

a(8)=3 because only 1, 4, and 64 qualify. (The qualification for n=8 is that the final digit must be at most 4 and the nexttolast digit must be at most 6.)


MAPLE

A162157 := proc(n) local n2dgs, a, k, mtch, ksq, d ; n2dgs := convert(n^2, base, 10) ; a := 0 ; for k from 1 to n do mtch := true; ksq := convert(k^2, base, 10) ; for d from 1 to nops(ksq) do if op(d, ksq)> op(d, n2dgs) then mtch := false; break; fi; od: if mtch then a := a+1; fi; od: a ; end: seq(A162157(n), n=1..80) ; # R. J. Mathar, Jul 04 2009


MATHEMATICA

Table[With[{d = IntegerDigits[n^2]}, Count[Range[n], k_ /; Inner[LessEqual, PadLeft[IntegerDigits[k^2], Length@ d], d, And]]], {n, 80}] (* Michael De Vlieger, Feb 24 2019 *)


CROSSREFS

Sequence in context: A020910 A029065 A263253 * A060210 A260460 A000025
Adjacent sequences: A162154 A162155 A162156 * A162158 A162159 A162160


KEYWORD

nonn,base


AUTHOR

J. Lowell, Jun 26 2009


EXTENSIONS

a(14) inserted and sequence extended by R. J. Mathar, Jul 04 2009


STATUS

approved



