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.
%I A329794 #42 Sep 07 2021 16:47:27 %S A329794 2,1,2,3,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,5,6,7,8,9,21,1,2,3,4,6,7,8, %T A329794 9,19,10,11,1,2,3,9,17,18,19,29,20,10,11,12,13,19,27,28,29,39,30,20, %U A329794 21,22,10,4,5,6,7,8,1 %N A329794 a(n) is the smallest positive k such that box(k,n) is a positive square, where box(k,n) is Eric Angelini's mapping defined in the Comments. %C A329794 _Eric Angelini_'s "box" map box(i,j) is defined as follows (see A330240). Write i, j in base 10 aligned to the right, say %C A329794 i = bcd...ef %C A329794 j = .gh...pq %C A329794 Then the decimal expansion of box(i,j) is |b-0|, |c-g|, |d-h|, ..., |e-p|, |f-q|. %C A329794 For example, box(12345,909) = 12644. %H A329794 Rémy Sigrist, <a href="/A329794/b329794.txt">Table of n, a(n) for n = 1..25000</a> %F A329794 a(n) < n except for a(1) = 2. - _M. F. Hasler_, Dec 07 2019 %e A329794 For n = 1 the smallest k producing a square is 2 (as box(1,2) = 1, this 1 being the square of 1); %e A329794 For n = 2 the smallest k producing a square is 1 (as box(2,1) = 1, this 1 being the square of 1); %e A329794 For n = 3 the smallest k producing a square is 2 (as box(3,2) = 1, this 1 being the square of 1); %e A329794 For n = 5 the smallest k producing a square is 3 (as box(5,1) = 4, this 4 being the square of 2); %e A329794 For n = 16 the smallest k producing a square is 12 (as box(16,12) = 4, this 4 being the square of 2). %t A329794 BOX[a_,b_]:=FromDigits@Abs[Subtract@@PadLeft[IntegerDigits/@{a,b}]];Table[k=1;While[!IntegerQ[a=Sqrt@BOX[k,n]]||a==0,k++];k,{n,100}] (* _Giorgos Kalogeropoulos_, Aug 20 2021 *) %o A329794 (PARI) box(x,y) = if (x==0 || y==0, x+y, 10*box(x\10,y\10) + abs((x%10) - (y%10))) %o A329794 a(n) = for (k=1, oo, my (b=box(n,k)); if (b && issquare(b), return (b))) \\ _Rémy Sigrist_, Dec 07 2019 %o A329794 (PARI) A329794(n)={n>1&&for(k=1,n,issquare(A330240(n,k))&&return(k));2} \\ _M. F. Hasler_, Dec 07 2019 %o A329794 (Python) %o A329794 from sympy.ntheory.primetest import is_square %o A329794 def positive_square(n): return n > 0 and is_square(n) %o A329794 def box(i, j): %o A329794 si = str(i); sj = str(j); m = max(len(si), len(sj)) %o A329794 si, sj = si.zfill(m), sj.zfill(m) %o A329794 return int("".join([str(abs(int(si[k])-int(sj[k]))) for k in range(m)])) %o A329794 def a(n): %o A329794 k = 1 %o A329794 while not positive_square(box(k, n)): k += 1 %o A329794 return k %o A329794 print([a(n) for n in range(1, 66)]) # _Michael S. Branicky_, Aug 20 2021 %Y A329794 Cf. A329795, A330240. %K A329794 nonn,base,look %O A329794 1,1 %A A329794 _N. J. A. Sloane_, Dec 07 2019, based on a posting by _Eric Angelini_ to the Sequence Fans Mailing List, Dec 07 2019. (Thanks to _Rémy Sigrist_ for correcting the definition.)