login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A162157 Number of square numbers from 1 to n^2 where all decimal digits are at most the corresponding digit of n^2. 1

%I

%S 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,

%T 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,

%U 19,11,9,5,11,21,52,11,11,21,40,15,14,7,2,10,18,30,23,45,37,7,5,3

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

%C 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 next-to-last digit greater than 6 (from 169). a(17) is only 17 because of 196 having a next-to-last 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.

%H Michael De Vlieger, <a href="/A162157/b162157.txt">Table of n, a(n) for n = 1..10000</a>

%e 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 next-to-last digit must be at most 6.)

%p 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

%t 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 *)

%K nonn,base

%O 1,2

%A _J. Lowell_, Jun 26 2009

%E a(14) inserted and sequence extended by _R. J. Mathar_, Jul 04 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 22 17:26 EDT 2021. Contains 347607 sequences. (Running on oeis4.)