login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A109688
Smallest square that contains exactly n occurrences of the string n.
1
1, 1, 225, 343396, 44944, 505575225, 4666665969, 77770707876, 388888184881, 9499999990849, 1010101019780101025109910101001, 1101191170117113111111301111961124, 121214127521273511212121212512121241, 135131321313113136131313387213513731136
OFFSET
0,3
COMMENTS
Occurrences are counted without overlap, so 1111 has two occurrences of 11, not 3. - Michael S. Branicky, Aug 12 2023
LINKS
EXAMPLE
a(2)=225=15^2 since this is the first square that contains two 2's.
MATHEMATICA
With[{sqs=Range[0, 3100000]^2}, Flatten[Table[Select[sqs, DigitCount[#, 10, n] == n&, 1], {n, 9}]]] (* Harvey P. Dale, May 04 2012 *)
PROG
(Python)
from math import isqrt
def a(n):
sn = str(n)
k = 1 if n == 0 else isqrt(int(sn*n))
while True:
if str(k*k).count(sn) == n:
return k*k
k += 1
print([a(n) for n in range(10)]) # Michael S. Branicky, Feb 02 2022
CROSSREFS
Sequence in context: A171109 A239478 A304314 * A195277 A319944 A013757
KEYWORD
nonn,base
AUTHOR
Erich Friedman, Aug 07 2005
EXTENSIONS
Corrected and extended by Giovanni Resta, Apr 05 2006
a(10) and beyond from Bert Dobbelaere, Sep 05 2023
STATUS
approved