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.

A343740 a(n) is the digit position of the first appearance of the last digit to appear in sqrt(n) (or -1 if n is a square).

This page as a plain text file.
%I A343740 #16 Aug 06 2021 05:53:31
%S A343740 -1,19,23,-1,37,39,45,36,-1,27,17,25,15,36,19,-1,20,36,25,37,28,13,27,
%T A343740 52,-1,39,17,38,27,26,17,23,24,37,19,-1,25,26,26,41,58,57,25,12,25,22,
%U A343740 24,19,-1,33,48,23,41,49,23,32,32,23,30,19,17,31,27,-1,24
%N A343740 a(n) is the digit position of the first appearance of the last digit to appear in sqrt(n) (or -1 if n is a square).
%C A343740 A343739(n) is the last digit to appear in the decimal expansion of sqrt(n) (or -1 if n is a square), so a(n) is the digit position of the first appearance of the digit A343739(n) in sqrt(n).
%C A343740 (The first digit of sqrt(n) is counted as digit position 1; the decimal point is disregarded.)
%F A343740 a(100^q*n) = a(n), q > 0. - _Bernard Schott_, Jul 29 2021
%e A343740 a(2)=19 because A343739(2)=8 and the first appearance of an 8 in sqrt(2) = 1.414213562373095048... is at the 19th digit;
%e A343740 a(24)=52 because A343739(24)=0 and the first appearance of a 0 in sqrt(24) = 4.898979485566356196394568149411782783931894961313340... is at the 52nd digit.
%t A343740 Table[If[IntegerQ@ Sqrt@ n, -1, Function[s, Max@ Array[FirstPosition[s, #][[1]] &, 10, 0]]@ RealDigits[Sqrt[n], 10, 120][[1]]], {n, 65}] (* _Michael De Vlieger_, Jul 06 2021 *)
%o A343740 (Python 3.8+)
%o A343740 from math import isqrt
%o A343740 def A343740(n):
%o A343740     i = isqrt(n)
%o A343740     if i**2 == n:
%o A343740         return -1
%o A343740     m, dset, pos = n, set(), 0
%o A343740     for d in (int(s) for s in str(i)):
%o A343740         dset.add(d)
%o A343740         pos += 1
%o A343740         if len(dset) == 10:
%o A343740             return pos
%o A343740     while len(dset) < 10:
%o A343740         m *= 100
%o A343740         d = isqrt(m) % 10
%o A343740         dset.add(d)
%o A343740         pos += 1
%o A343740     return pos # _Chai Wah Wu_, Jul 07 2021
%Y A343740 Cf. A023961, A343739, A343741, A343742.
%K A343740 sign,base
%O A343740 1,2
%A A343740 _Jon E. Schoenfield_, Jul 05 2021