Search: id:A162157 Results 1-1 of 1 results found. %I A162157 %S A162157 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, %T A162157 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, %U A162157 9,5,11,21,52,11,11,21,40,15,14,7,2,10,18,30,23,45,37,7,5,3 %N A162157 Number of square numbers from 1 to n^2 where all digits are at most the corresponding digit of n^2 %C A162157 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. %e A162157 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 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) ; [From R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Jul 04 2009] %Y A162157 Sequence in context: A130499 A020910 A029065 this_sequence A060210 A000025 A036020 %Y A162157 Adjacent sequences: A162154 A162155 A162156 this_sequence A162158 A162159 A162160 %K A162157 nonn %O A162157 1,2 %A A162157 J. Lowell (jhbubby(AT)mindspring.com), Jun 26 2009 %E A162157 a(14) inserted and sequence extended by R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Jul 04 2009 Search completed in 0.001 seconds