%I A124602
%S A124602 1,1,5,4,1,1,1,1,1,1,4,6,25,8,28,4,1,3,2,19,4,4,12,9,34,1,13,7,2,20,5,
10,8,7,25,
%T A124602 19,1,4,10,2,3,6,17,9,5,5,4,18,3,1,17,6,2,2,8,16,16,11,17,27,10,5,31,5,
1,4,3,7,2,6,
%U A124602 8,3,5,27,4,5,32,13,12,33,5,1,18,14,56,2,2,3,23,10,7,7,12,13,13,35,13,
18,24,26,1
%V A124602 -1,-1,5,4,1,1,1,1,1,-1,4,6,25,8,28,4,-1,3,2,19,4,4,12,9,34,-1,13,7,2,
20,5,10,8,7,25,
%W A124602 19,-1,4,10,2,3,6,17,9,5,5,4,18,3,-1,17,6,2,2,8,16,16,11,17,27,10,5,31,
5,-1,4,3,7,2,6,
%X A124602 8,3,5,27,4,5,32,13,12,33,5,-1,18,14,56,2,2,3,23,10,7,7,12,13,13,35,13,
18,24,26,-1
%N A124602 Position of the first 2 in the decimal expansion of the square root of
n, or -1 if 2 never appears.
%o A124602 (PARI) digitpos(n,m) = /* m-th digit in sqrt expansions */ { local(x,
y,r,dot); default(realprecision,1000); for(x=0,n, r = sqrt(x); if(issquare(x),
y=find(Str(floor(r)),m), y=find(Str(r),m); dot=find(Str(r),".");
if(dot < y, y--); ); if(y, print1(y","),print1(-1",") ) ) } find(str,
match) = /* Revised 2007 */ { local(lnm,lns,tstr,vstr,x,j); vstr=Vec(Str(str));
match=Str(match); lns=length(str); lnm=length(match); for(x=1,lns-lnm+1,
tstr=""; for(j=x,x+lnm-1, tstr=concat(tstr,vstr[j]); ); if(match==tstr,
return(x)) ); return(0); }
%Y A124602 Sequence in context: A129522 A133842 A115637 this_sequence A132707 A046575
A154739
%Y A124602 Adjacent sequences: A124599 A124600 A124601 this_sequence A124603 A124604
A124605
%K A124602 base,easy,sign
%O A124602 0,3
%A A124602 Cino Hilliard (hillcino368(AT)hotmail.com), Dec 22 2006, corrected Jul
18 2007
|