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.

Showing 1-10 of 11 results. Next

A030000 a(n) is the smallest nonnegative number k such that the decimal expansion of 2^k contains the string n.

Original entry on oeis.org

10, 0, 1, 5, 2, 8, 4, 15, 3, 12, 10, 40, 7, 17, 18, 21, 4, 27, 30, 13, 11, 18, 43, 41, 10, 8, 18, 15, 7, 32, 22, 17, 5, 25, 27, 25, 16, 30, 14, 42, 12, 22, 19, 22, 18, 28, 42, 31, 11, 32, 52, 9, 19, 16, 25, 16, 8, 20, 33, 33, 23, 58, 18, 14, 6, 16, 46, 24, 15, 34, 29, 21, 17, 30
Offset: 0

Views

Author

Keywords

Comments

a(n) is well-defined for all n, because 2^k can actually start with (not just contain) any finite sequence of digits without leading zeros. This follows from the facts that log_10(2) is irrational and that the set of fractional parts of n*x is dense in [0,1] if x is irrational. - Pontus von Brömssen, Jul 21 2021

Examples

			2^12 = 4096 is first power of 2 containing a 9, so a(9) = 12.
		

Crossrefs

Cf. A030001 (the actual powers of 2), A063565, A018856, A000079, A372044, A372045.
See also A321043.

Programs

  • Haskell
    import Data.List (isInfixOf, findIndex)
    import Data.Maybe (fromJust)
    a030000 n =
       fromJust $ findIndex (show n `isInfixOf`) $ map show a000079_list
    -- Reinhard Zumkeller, Aug 04 2011
    
  • Mathematica
    Table[ i=0; While[ StringPosition[ ToString[ 2^i ], ToString[ n ] ]=={}, i++ ]; i, {n, 0, 80} ]
    snn[n_]:=Module[{k=0},While[SequenceCount[IntegerDigits[2^k],IntegerDigits[n]]==0,k++];k]; Array[snn,100,0] (* Harvey P. Dale, Mar 16 2025 *)
  • PARI
    a(n) = {if (n==1, return (0)); my(k=1, sn = Str(n)); while (#strsplit(Str(2^k), sn) == 1, k++); k;} \\ Michel Marcus, Mar 06 2021
    
  • PARI
    apply( A030000(n)={n=Str(n);for(k=0,oo,#strsplit(Str(2^k),n)>1&& return(k))}, [0..99]) \\ Also allows to search for digit strings with leading zeros, e.g., "00" => k=53. - M. F. Hasler, Jul 11 2021
    
  • Python
    def a(n):
      k, strn = 0, str(n)
      while strn not in str(2**k): k += 1
      return k
    print([a(n) for n in range(74)]) # Michael S. Branicky, Mar 06 2021

Formula

a(n) <= A018856(n) for n >= 1. - Pontus von Brömssen, Jul 21 2021

Extensions

More terms from Hans Havermann

A018802 Smallest power of 2 that begins with n.

Original entry on oeis.org

1, 2, 32, 4, 512, 64, 70368744177664, 8, 9007199254740992, 1024, 1125899906842624, 128, 131072, 140737488355328, 151115727451828646838272, 16, 17179869184, 18014398509481984, 19342813113834066795298816, 2048, 2147483648
Offset: 1

Views

Author

Keywords

Examples

			a(7) = 70368744177664, because 2^46 is the smallest power of 2 that begins with a 7.
		

References

  • A. M. Yaglom and I. M. Yaglom, Challenging Mathematical Problems With Elementary Solutions, Vol. 1 pp. 29, 199-200; Prob. 91a, Dover NY 1987

Crossrefs

Cf. A018856.
Cf. this sequence (k=2), A018857 (k=3), A018859 (k=4), A018861 (k=5), A018863 (k=6), A018865 (k=7), A018867 (k=8), A018869 (k=9).

Programs

  • R
    library(gmp); ndig<-function(i) nchar(as.character(as.bigz(i))) y=as.bigz(rep(0,100)); for(i in 1:100) {n=as.bigz(2); while(substr(n,1,ndig(i))!=as.character(i)) n=n*2; y[i]=n; } # Christian N. K. Anderson, May 23 2013

Formula

a(n) = 2^A018856(n). - Seiichi Manyama, Jan 29 2017
a(2^n) = 2^n for n >= 0. - Seiichi Manyama, Jan 29 2017

A176763 Smallest power of 3 whose decimal expansion contains n.

Original entry on oeis.org

59049, 1, 27, 3, 243, 6561, 6561, 27, 81, 9, 10460353203, 1162261467, 129140163, 31381059609, 177147, 1594323, 129140163, 177147, 2187, 19683, 387420489, 2187, 1162261467, 1594323, 243, 2541865828329, 1162261467, 27, 282429536481, 729, 43046721, 531441, 1594323
Offset: 0

Views

Author

Jonathan Vos Post, Apr 25 2010

Keywords

Comments

This is to 3 as A030001 is to 2.

Examples

			a(1) = 1 because 3^0 = 1 has "1" as a substring (not a proper substring, though).
a(2) = 27 because 3^3 = 27 has "2" as a substring.
a(10) = 10460353203 because 3^21 = 10460353203 is the smallest power of 3 whose decimal expansion contains "10" (in this case, "10" happens to be the left-hand or initial digits, but that is not generally true).
		

Crossrefs

Programs

  • Mathematica
    A176763[n_] := Block[{k = -1}, While[StringFreeQ[IntegerString[3^++k], IntegerString[n]]]; 3^k]; Array[A176763, 50, 0] (* Paolo Xausa, Apr 03 2024 *)
  • Python
    def a(n):
        k, strn = 0, str(n)
        while strn not in str(3**k): k += 1
        return 3**k
    print([a(n) for n in range(33)]) # Michael S. Branicky, Apr 03 2024

Formula

a(n) = MIN{A000244(i) such that n in decimal representation is a substring of A000244(i)}.

Extensions

More terms from Sean A. Irvine and Jon E. Schoenfield, May 05 2010
a(0) prepended by Paolo Xausa, Apr 03 2024

A363060 Numbers k such that 5 is the first digit of 2^k.

Original entry on oeis.org

9, 19, 29, 39, 49, 59, 69, 102, 112, 122, 132, 142, 152, 162, 172, 195, 205, 215, 225, 235, 245, 255, 265, 298, 308, 318, 328, 338, 348, 358, 391, 401, 411, 421, 431, 441, 451, 461, 494, 504, 514, 524, 534, 544, 554, 587, 597, 607, 617, 627, 637, 647, 657, 680, 690
Offset: 1

Views

Author

Ctibor O. Zizka, May 16 2023

Keywords

Comments

The asymptotic density of this sequence is log_10(6/5) = 0.0791812... . - Amiram Eldar, May 16 2023
In base B we may consider numbers k such that some integer Y >= 1 forms the first digit(s) of X^k. For such numbers k the following inequality holds: log_B(Y) - floor(log_B(Y)) <= k*log_B(X) - floor(k*log_B(X)) < log_B(Y+1) - floor(log_B(Y+1)). The irrationality of log_B(X) is the necessary condition; see the Links section. Examples in the OEIS: B = 10, X = 2; Y = 1 (A067497), Y = 2 (A067469), Y = 3 (A172404).

Examples

			k = 9: the first digit of 2^9 = 512 is 5, thus k = 9 is a term.
		

Crossrefs

Programs

  • Maple
    R:= NULL: count:= 0: t:= 1:
    for k from 1 while count < 100 do
      t:= 2*t;
      if floor(t/10^ilog10(t)) = 5 then R:= R,k; count:= count+1 fi
    od:
    R; # Robert Israel, May 19 2023
  • Mathematica
    Select[Range[700], IntegerDigits[2^#][[1]] == 5 &] (* Amiram Eldar, May 16 2023 *)
  • PARI
    isok(k) = digits(2^k)[1] == 5; \\ Michel Marcus, May 16 2023
    
  • Python
    from itertools import count, islice
    def A363060_gen(startvalue=1): # generator of terms >= startvalue
        m = 1<<(k:=max(startvalue,1))
        for i in count(k):
            if str(m)[0]=='5':
                yield i
            m <<= 1
    A363060_list = list(islice(A363060_gen(),20)) # Chai Wah Wu, May 21 2023

A152561 Smallest m such that 2^m begins with a 1 and n 0's.

Original entry on oeis.org

0, 10, 196, 2136, 15437, 70777, 325147, 6432163, 198096465, 15042141867, 76590952427, 82361153417, 578451474249, 6198243909905, 410654730169643, 2178891522315645, 11458333085072746, 112404439328411815, 2539468772213180761, 4415969241540963378, 218809557168391974468
Offset: 0

Views

Author

Jon E. Schoenfield, Dec 07 2008

Keywords

Examples

			2^a(0) = 2^0     = 1
2^a(1) = 2^10    = 1024
2^a(2) = 2^196   = 1004336277661868922...
2^a(3) = 2^2136  = 1000162894137615530...
2^a(4) = 2^15437 = 1000099165462017237...
2^a(5) = 2^70777 = 1000007160137454597...
		

Crossrefs

Formula

a(n) = A018856(10^n). - Andrew Howroyd, Sep 30 2024

Extensions

a(0)=0 prepended by Pontus von Brömssen, May 11 2021
a(18) and above from Zhao Hui Du, Oct 03 2024

A180690 11^a(n) is smallest power of 11 beginning with n.

Original entry on oeis.org

0, 8, 12, 15, 17, 19, 21, 22, 24, 25, 1, 2, 3, 4, 29, 5, 6, 55, 7, 56, 8, 57, 9, 82, 10, 107, 59, 11, 84, 36, 12, 85, 61, 13, 110, 62, 14, 135, 87, 63, 15, 136, 88, 64, 16, 137, 113, 89, 41, 17, 138, 114, 66, 42, 18, 139, 115, 91, 67, 43, 19, 140, 116, 92, 68, 44, 20, 141, 117, 93
Offset: 1

Views

Author

Daniel Mondot, Sep 17 2010

Keywords

Crossrefs

A186774 Smallest power of n whose decimal expansion contains n+1, or 0 if no such number exists.

Original entry on oeis.org

32, 243, 256, 625, 7776, 16807, 4096, 31381059609, 0, 121, 79496847203390844133441536, 51185893014090757, 155568095557812224, 22168378200531005859375, 17592186044416, 118587876497, 11019960576, 42052983462257059
Offset: 2

Views

Author

Jonathan Vos Post, Feb 26 2011

Keywords

Comments

More precisely: smallest power of n (with positive integer exponent) whose decimal expansion contains n+1 as a substring of consecutive decimal digits. This is A[n,n+1], the diagonal above the trivial main diagonal of the array A[k,n] = Smallest power of k whose decimal expansion contains n.
The k=2 row A[2,n] = A030001.
The k=3 row A[3,n] = A176763.
The k=4 row A[4,n] = A176764.
The k=5 row A[5,n] = A176765...
a(10^k+1) = (10^k+1)^2 for k > 0. - Chai Wah Wu, Feb 13 2017

Examples

			a(2) = 32 = A030001(3) = smallest power of 2 whose decimal expansion contains 3.
a(3) = 243 = A176763(4) = smallest power of 3 whose decimal expansion contains 4.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local t, k;
          if type(simplify(log[10](n)), integer) then 0
        else t:= cat(n+1);
             for k from 2 while searchtext(t, cat(n^k))=0
             do od; n^k
          fi
        end:
    seq(a(n), n=2..40);  # Alois P. Heinz, Feb 26 2011
  • Python
    def A186774(n):
        if sum(int(d) for d in str(n)) == 1:
            return 0
        sn, k = str(n+1), 1
        while sn not in str(k):
            k *= n
        return k # Chai Wah Wu, Feb 13 2017

A371887 a(1) = 1; for n > 1, a(n) is the smallest positive integer k such that the digits of 2^k contain 2^a(n-1) as a proper substring.

Original entry on oeis.org

1, 5, 15, 507
Offset: 1

Views

Author

Adam Vulic, Apr 11 2024

Keywords

Comments

From David A. Corneth, Apr 11 2024: (Start)
This sequence is well defined as A030000 is well defined; every finite string of digits is contained in some power of 2.
An upper bound for a(n), n > 1, can be found by solving 2^k == 2^a(n-1) (mod 10^m) where m is the number of digits of 2^a(n-1) (cf. A034887). This gives a(n) <= k = a(n-1) + 4*5^(m-1) (cf. A005054). So a(5) <= 507 + 4*5^152, which is about 7*10^106. (End)

Examples

			a(2) is the smallest k > 0 such that the digits of 2^k contain 2^a(1) = 2^1 = 2 as a proper substring, so a(2) = 5. (2^5 = 32.)
a(3) is the smallest k > 0 such that the digits of 2^k contain 2^a(2) = 32 as a proper substring, so a(3) = 15. (2^15 = 32768.)
		

Crossrefs

Programs

  • Mathematica
    k = 0; Rest@ NestList[(While[SequenceCount[IntegerDigits[2^k], IntegerDigits[2^#]] == 0, k++]; k++; k - 1) &, 1, 4] (* Michael De Vlieger, Apr 19 2024 *)

A374923 a(n) is the least k such that 2^k begins with n!.

Original entry on oeis.org

0, 0, 1, 6, 81, 80, 56, 7284, 33889, 2044921, 8151937, 127668791, 258943304, 19207561921, 189815680859, 2687562198191, 75909586168557, 512148453482307, 5376323935222903, 502774568129731130, 1053338431686717460, 122114339415457901831, 2120280158164651048122
Offset: 0

Views

Author

Zhining Yang, Jul 23 2024

Keywords

Examples

			a(4) = 81 because 2^81 = 2417851639229258349412352 is the smallest power of 2 beginning with 4! = 24.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{target = IntegerDigits[n!], k = 0},
       While[UnsameQ[Take[IntegerDigits[2^k], Length@target], target],
        k++]; k];
    Table[a[n], {n, 0, 8}]

Formula

a(n) = A018856(n!).

Extensions

a(13) onwards from Zhao Hui Du, Oct 02 2024

A363873 Least k such that 2^k begins with n but is not exactly n.

Original entry on oeis.org

4, 8, 5, 12, 9, 6, 46, 13, 53, 10, 50, 7, 17, 47, 77, 14, 34, 54, 84, 11, 31, 51, 61, 81, 8, 18, 38, 48, 68, 78, 98, 15, 25, 35, 45, 55, 75, 85, 95, 12, 22, 32, 42, 145, 52, 62, 72, 82, 92, 102, 9, 19, 29, 39, 142, 49, 59, 162, 69, 79, 89, 192, 99, 109, 16, 119, 26, 36, 139, 46
Offset: 1

Views

Author

Robert G. Wilson v, Jul 03 2023

Keywords

Comments

This is not an injective function. a(2) = a(25) = 8.
a(n) > 3.

Examples

			a(1) = 4 since 2^4 = 16 starts with 1 and is not 1 itself (the way 2^0 = 1 would be);
a(2) = 8 (not 1: 2^1 = 2) since 2^8 = 256;
a(3) = 5 since 2^5 = 32;
a(4) = 12 (not 2: 2^2 = 4) since 2^12 = 4096;
a(5) = 9 since 2^9 = 512; etc.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{j = IntegerLength@ n, k = 1}, While[ IntegerLength[2^k] < j || Quotient[2^k, 10^(IntegerLength[2^k] - j)] != n || n == 2^k, k++]; k]; Array[ a, 70]
  • Python
    def A363873(n):
        m, s = 1<<(k:=n.bit_length()-1), str(n)
        while m<=n or not str(m).startswith(s):
            k += 1
            m <<= 1
        return k # Chai Wah Wu, Aug 06 2023
Showing 1-10 of 11 results. Next