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.

A304290 Numbers k such that k-1 is a substring of k^2.

Original entry on oeis.org

9, 37, 99, 370, 999, 3367, 9999, 22186, 99999, 221860, 333667, 625001, 625009, 859415, 926968, 999999, 1507152, 3125001, 3701562, 7012141, 9375009, 9999999, 20506249, 28658098, 33336667, 46875009, 78125001, 79632152, 86609391, 98089448, 99999999, 306481073
Offset: 1

Views

Author

Paolo P. Lava, May 24 2018

Keywords

Comments

The repdigit sequence A002283, apart from the first term 0, is a subset.
In fact (999...9)^2 = (10^n-1)^2 = 10^n((10^n-1)-1)+1 = 10^n(999...9-1)+1 = 10^n(999...8)+1 = 999...8000...1.
The sequence A074992, apart from the first term 1, is a subsequence. - Michel Marcus, May 27 2018

Examples

			9^2 = 81 and 9-1 = 8 is a substring.
37^2 = 1369 and 37-1 = 36 is a substring.
		

Crossrefs

Programs

  • Maple
    P:=proc(q) local a,b,k,n; a:=2; b:=1;
    for n from 1 to q do for k from 1 to ilog10(a^2)-ilog10(b)+1 do
    if b=trunc(a^2/10^(k-1)) mod 10^(ilog10(b)+1) then print(a); fi; od;
    b:=a; a:=a+1; od; print(); end: P(10^8);
  • Mathematica
    Select[Range[10^6], SequenceCount[IntegerDigits[#^2], IntegerDigits[# - 1]] > 0 &] (* Michael De Vlieger, May 27 2018 *)
  • Python
    A304290_list = [k for k in range(10**6) if str(k-1) in str(k**2)] # Chai Wah Wu, Oct 22 2018

Extensions

a(32) from Jon E. Schoenfield, Jun 01 2018