A304290 Numbers k such that k-1 is a substring of k^2.
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
Examples
9^2 = 81 and 9-1 = 8 is a substring. 37^2 = 1369 and 37-1 = 36 is a substring.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..65 (n = 1..41 from Jon E. Schoenfield)
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
Comments