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.

A058433 Numbers k such that k^2 contains only digits {0,3,9}, not ending with zero.

This page as a plain text file.
%I A058433 #27 May 28 2025 18:37:51
%S A058433 3,969071253
%N A058433 Numbers k such that k^2 contains only digits {0,3,9}, not ending with zero.
%C A058433 No more terms up to 10^23. - _Charles R Greathouse IV_, Jul 27 2009
%H A058433 P. De Geest, <a href="https://www.worldofnumbers.com/threedigits.htm">Index to related sequences</a>
%H A058433 Hisanori Mishima, <a href="http://www.asahi-net.or.jp/~KC2H-MSM/mathland/math02/math0210.htm#039">Sporadic tridigital solutions</a>
%t A058433 Sqrt[#]&/@Select[FromDigits/@Tuples[{0,3,9},18],Mod[#,10]!=0&&IntegerQ[Sqrt[#]]&] (* _Harvey P. Dale_, May 28 2025 *)
%o A058433 (PARI) /* helper function: */
%o A058433 admissibleMod(M=10^5, t=[3, 9], debug=0)={ my(p=1, v); while(M > p *= 10,
%o A058433     t = concat([t, t + t[1]*v=vector(#t, i, p), t + t[2]*v]));
%o A058433     debug && print("t="t); t=Set(t); v=[];
%o A058433     for(k=1, M, setsearch(t, k^2 % M) && v=concat(v, k)); concat(v, M+v[1])}
%o A058433 /* optional arguments: Nmax = upper search limit, N = start / lower limit,
%o A058433    addMod = step/chunk size, debug: 0=silent, 1=verbose */
%o A058433 A058433(Nmax=1e10, N=1, addMod=10^5, debug=1)={ my(a=[], d=1,
%o A058433   addNext = admissibleMod(addMod=10^logint(addMod\/1, 10), [3, 9]),
%o A058433   add = vector(addMod, i, i-1 > addNext[d] && d++; addNext[d]-i+1),
%o A058433   pow10 = [10^k | k<-[0..logint((Nmax \/= 1)^2, 10)]],
%o A058433   nextOK = [if(n, n*pow10) | n<-[0, 2, 1, 0, 5, 4, 3, 2, 1, 0]]); N \/= 1;
%o A058433   while( Nmax >= N, my(N2 = N^2, numDigits = logint(N2, 10)+1,
%o A058433                        place = nextOK[1 + d = N2 \ pow10[numDigits]]);
%o A058433     if( place, N = max(sqrtint(place[numDigits] + d*pow10[numDigits]), N+1);
%o A058433                next); place = 1;
%o A058433     my(Nnext = min(sqrtint((d+1)*pow10[numDigits]), Nmax));
%o A058433     debug && print("checking from "N" to "Nnext": <= ",
%o A058433                    1+max(0, Nnext-N)*(#addNext-1)\ addMod," candidates.");
%o A058433     while( Nnext >= N += add[1 + N % addMod],
%o A058433       my(dr = divrem( N2 = N^2, pow10[place = numDigits] ));
%o A058433       while( place-- && !d=nextOK[1+ (dr = divrem(dr[2], pow10[place]))[1]], );
%o A058433       place || break; N = sqrtint(N2 - dr[2] + d[place]) + 1;
%o A058433     ); if( !place, debug && print(N "^2 = ", N^2); a=concat(a,N));
%o A058433     N = Nnext*3\2+1); a} \\ _M. F. Hasler_, May 14 2007
%Y A058433 Cf. A058434 (the squares), A058429 (similar for digits {0,3,4}).
%K A058433 nonn,base,hard,more,bref
%O A058433 1,1
%A A058433 _Patrick De Geest_, Nov 15 2000