login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A109688 Smallest square that contains exactly n occurrences of the string n. 1

%I #23 Sep 05 2023 16:46:27

%S 1,1,225,343396,44944,505575225,4666665969,77770707876,388888184881,

%T 9499999990849,1010101019780101025109910101001,

%U 1101191170117113111111301111961124,121214127521273511212121212512121241,135131321313113136131313387213513731136

%N Smallest square that contains exactly n occurrences of the string n.

%C Occurrences are counted without overlap, so 1111 has two occurrences of 11, not 3. - _Michael S. Branicky_, Aug 12 2023

%H Bert Dobbelaere, <a href="/A109688/b109688.txt">Table of n, a(n) for n = 0..15</a>

%e a(2)=225=15^2 since this is the first square that contains two 2's.

%t With[{sqs=Range[0,3100000]^2},Flatten[Table[Select[sqs,DigitCount[#,10,n] == n&,1],{n,9}]]] (* _Harvey P. Dale_, May 04 2012 *)

%o (Python)

%o from math import isqrt

%o def a(n):

%o sn = str(n)

%o k = 1 if n == 0 else isqrt(int(sn*n))

%o while True:

%o if str(k*k).count(sn) == n:

%o return k*k

%o k += 1

%o print([a(n) for n in range(10)]) # _Michael S. Branicky_, Feb 02 2022

%K nonn,base

%O 0,3

%A _Erich Friedman_, Aug 07 2005

%E Corrected and extended by _Giovanni Resta_, Apr 05 2006

%E a(10) and beyond from _Bert Dobbelaere_, Sep 05 2023

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 01:40 EDT 2024. Contains 371696 sequences. (Running on oeis4.)