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-3 of 3 results.

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

A321128 Single-digit numbers in the order in which they first appear in the decimal expansions of prime numbers, followed by the two-digit numbers in the order in which they appear, then the three-digit numbers, and so on.

Original entry on oeis.org

2, 3, 5, 7, 1, 9, 4, 6, 8, 0, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 10, 12, 27, 39, 14, 49, 15, 51, 57, 16, 63, 18, 81, 91, 93, 99, 21, 22, 33, 24, 25, 26, 69, 77, 28, 30, 34, 35, 36, 38, 40, 42, 44, 45, 46, 48, 87
Offset: 1

Views

Author

Rémy Sigrist, Oct 27 2018

Keywords

Comments

This sequence is a variant of A321043.
This sequence establishes a bijection from the positive integers to the nonnegative integers; see A320938 for the inverse.
Prime numbers appear in increasing order.

Examples

			The first terms, alongside the corresponding prime numbers, are:
  n   a(n)  Prime
  --  ----  -----
   1     2      2
   2     3      3
   3     5      5
   4     7      7
   5     1     11
   6     9     19
   7     4     41
   8     6     61
   9     8     83
  10     0    101
  11    11     11
  12    13     13
  ...
  30    89     89
  31    97     97
  32    10    101
  33    12    127
  34    27    127
  35    39    139
  36    14    149
  37    49    149
		

Crossrefs

Cf. A000010, A000040, A320938 (inverse), A321043.

Programs

  • PARI
    See Links section.

A330384 Single-digit numbers in order of appearance in decimal expansions of composite numbers, followed by two-digit numbers in order of appearance, then three-digit numbers and so forth.

Original entry on oeis.org

4, 6, 8, 9, 1, 0, 2, 5, 7, 3, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 69, 70, 72, 74, 75, 76, 77, 78, 80, 81, 82, 84, 85, 86
Offset: 1

Views

Author

David Williams, Dec 12 2019

Keywords

Examples

			From _Rémy Sigrist_, Dec 24 2019: (Start)
The first terms, alongside the corresponding composite numbers, are:
  n   a(n)  Composite
  --  ----  ---------
   1     4          4
   2     6          6
   3     8          8
   4     9          9
   5     1         10
   6     0         10
   7     2         12
   8     5         15
   9     7         27
  10     3         30
  11    10         10
  12    12         12
  13    14         14
  ...
  79    99         99
  80    11        110
  81    17        117
  82    19        119
  83    23        123
(End)
		

Crossrefs

Programs

  • PARI
    \\ See Links section.

Extensions

More terms from Rémy Sigrist, Dec 24 2019
Showing 1-3 of 3 results.