cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A224955 Numbers that are not squares, but can become squares by prepending or appending one additional digit.

This page as a plain text file.
%I A224955 #22 Feb 27 2022 11:11:35
%S A224955 2,3,5,6,8,10,12,14,19,21,22,24,28,29,32,40,41,44,48,52,56,57,61,62,
%T A224955 67,69,72,76,78,84,89,90,96,102,108,115,116,122,129,136,152,156,160,
%U A224955 168,176,184,193,202,209,211,216,220,230,240,241,249,250,260,270,280
%N A224955 Numbers that are not squares, but can become squares by prepending or appending one additional digit.
%C A224955 There are potentially 15 ways for each number to become a square--by prepending a digit between 1 and 9, or appending one of {0,1,4,5,6,9}. However, only 74 of the first 10000 terms can become a square in more than one way.
%H A224955 Christian N. K. Anderson, <a href="/A224955/b224955.txt">Table of n, a(n) for n = 1..10000</a>
%H A224955 Christian N. K. Anderson, <a href="/A224955/a224955.txt">List of squares</a> that can be formed by concatenating one digit to the first 10000 terms.
%H A224955 Christian N. K. Anderson, <a href="/A224955/a224955.gif">Ulam spiral</a> of a(n), with brighter colors corresponding to the number of ways a term may become a square.
%e A224955 a(4)=6 because, though 6 is not a square, it can become a square by prepending a 1 to become 16. We can also obtain 36 and 64.
%p A224955 isA224955 := proc(n)
%p A224955     local p,ndgs;
%p A224955     if issqr(n) then
%p A224955         return false;
%p A224955     else
%p A224955         ndgs := convert(n,base,10) ;
%p A224955         for p from 1 to 9 do
%p A224955             [op(ndgs),p] ;
%p A224955             add(op(i,%)*10^(i-1),i=1..nops(%)) ;
%p A224955             if issqr(%) then
%p A224955                 return true;
%p A224955             end if;
%p A224955         end do:
%p A224955         for p in {0,1,4,5,6,9} do
%p A224955             [p,op(ndgs)] ;
%p A224955             add(op(i,%)*10^(i-1),i=1..nops(%)) ;
%p A224955             if issqr(%) then
%p A224955                 return true;
%p A224955             end if;
%p A224955         end do:
%p A224955         return false;
%p A224955     end if;
%p A224955 end proc:
%p A224955 n := 1;
%p A224955 c := 1;
%p A224955 while n <= 10000 do
%p A224955     if isA224955(c) then
%p A224955         printf("%d %d\n",n,c) ;
%p A224955         n := n+1 ;
%p A224955     end if;
%p A224955     c := c+1 ;
%p A224955 end do: # _R. J. Mathar_, Mar 14 2016
%t A224955 Module[{nn=300,pre=Range[9],app={0,1,4,5,6,9}},Select[Range[nn],(!IntegerQ[ Sqrt[ #]]) && (AnyTrue[Sqrt[pre*10^IntegerLength[#]+#],IntegerQ] || AnyTrue[ Sqrt[ 10#+app],IntegerQ])&]] (* _Harvey P. Dale_, Feb 27 2022 *)
%Y A224955 Cf. A023110, A000290.
%K A224955 nonn,base
%O A224955 1,1
%A A224955 _Kevin L. Schwartz_ and _Christian N. K. Anderson_, Apr 21 2013