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

A091873 Square roots of A068165.

Original entry on oeis.org

1, 5, 6, 2, 5, 4, 24, 9, 3, 10, 11, 11, 37, 12, 34, 4, 42, 33, 13, 45, 11, 15, 48, 18, 5, 16, 52, 17, 17, 48, 19, 18, 56, 18, 55, 6, 61, 59, 37, 20, 21, 65, 66, 12, 65, 64, 69, 22, 7, 50, 39, 23, 73, 71, 75, 16, 24, 72, 23, 40, 19, 25, 128, 8, 25, 26, 26, 41, 13, 52, 61, 27, 86, 28
Offset: 1

Views

Author

Ray Chandler, Feb 07 2004

Keywords

A068164 Smallest prime obtained from n by inserting zero or more decimal digits.

Original entry on oeis.org

11, 2, 3, 41, 5, 61, 7, 83, 19, 101, 11, 127, 13, 149, 151, 163, 17, 181, 19, 1201, 211, 223, 23, 241, 251, 263, 127, 281, 29, 307, 31, 1321, 233, 347, 353, 367, 37, 383, 139, 401, 41, 421, 43, 443, 457, 461, 47, 487, 149, 503, 151, 521, 53, 541, 557, 563, 157
Offset: 1

Views

Author

Amarnath Murthy, Feb 25 2002

Keywords

Comments

The digits may be added before, in the middle of, or after the digits of n.
a(n) = n for prime n, by definition. - Zak Seidov, Nov 13 2014
a(n) always exists. Proof. Suppose n is L digits long, and let n' = 10*n+1. The arithmetic progression k*10^(2L)+n' (k >= 0) contains infinitely many primes, by Dirichlet's theorem, and they all contain the digits of n. QED. - Robert Israel, Nov 13 2014. For another proof, see A018800.
Similar to but different from A062584. E.g. a(133) = 1033, but A062584(133) = 4133.

Examples

			Smallest prime formed from 20 is 1201, by placing 1 on both sides. Smallest prime formed from 33 is 233, by placing a 2 in front.
		

Crossrefs

Cf. A018800 (an upper bound), A060386, A062584 (also an upper bound).
Cf. also A068165.

Programs

  • Haskell
    a068164 n = head (filter isPrime (digitExtensions n))
    digitExtensions n = filter (includes n) [0..]
    includes n k = listIncludes (show n) (show k)
    listIncludes [] _ = True
    listIncludes (h:_) [] = False
    listIncludes l1@(h1:t1) (h2:t2) = if (h1 == h2) then (listIncludes t1 t2) else (listIncludes l1 t2)
    isPrime 1 = False
    isPrime n = not (hasDivisorAtLeast 2 n)
    hasDivisorAtLeast k n = (k*k <= n) && (((n `rem` k) == 0) || (hasDivisorAtLeast (k+1) n))
    
  • Maple
    A068164 := proc(n)
        local p,pdigs,plen,dmas,dmasdigs,i,j;
        # test all primes ascending
        p := 2;
        while true do
            pdigs := convert(p,base,10) ;
            plen := nops(pdigs) ;
            # binary digit mask over p
            for dmas from 2^plen-1 to 0 by -1 do
                dmasdigs := convert(dmas,base,2) ;
                pdel := [] ;
                for i from 1 to nops(dmasdigs) do
                    if op(i,dmasdigs) = 1 then
                        pdel := [op(pdel),op(i,pdigs)] ;
                    end if;
                end do:
                if n = add(op(j,pdel)*10^(j-1),j=1..nops(pdel)) then
                    return p;
                end if;
            end do:
            p := nextprime(p) ;
        end do:
    end proc:
    seq(A068164(n),n=1..120) ; # R. J. Mathar, Nov 13 2014
  • Python
    from sympy import sieve
    def dmo(n, t):
        if t < n: return False
        while n and t:
            if n%10 == t%10:
                n //= 10
            t //= 10
        return n == 0
    def a(n):
        return next(p for p in sieve if dmo(n, p))
    print([a(n) for n in range(1, 77)]) # Michael S. Branicky, Jan 21 2023

Extensions

Corrected by Ray Chandler, Oct 11 2003
Haskell code and b-file added by Allan C. Wechsler, Nov 13 2014

A029944 a(n)^2 contains n-th prime as a substring.

Original entry on oeis.org

5, 6, 5, 24, 34, 37, 42, 14, 48, 23, 56, 61, 21, 66, 69, 73, 77, 19, 26, 131, 86, 89, 94, 17, 176, 318, 321, 226, 331, 337, 113, 146, 371, 118, 339, 123, 397, 128, 409, 416, 134, 426, 438, 44, 346, 447, 46, 473, 472, 479, 483, 352, 79, 501, 507, 513, 519
Offset: 1

Views

Author

Keywords

Examples

			E.g. 34^2 = 1156 is first square that contains the string "11".
		

Crossrefs

Programs

  • Mathematica
    With[{e = 2}, Table[Function[p, k = 1; While[Length@ SequencePosition[ IntegerDigits[Set[c, k^e]], p] == 0, k++]; c]@ IntegerDigits@ Prime@ n, {n, 57}] ^(1/e)] (* Michael De Vlieger, May 04 2017, Version 10.1 *)

A038690 a(n)^2 is smallest square containing the string 'n'.

Original entry on oeis.org

0, 1, 5, 6, 2, 5, 4, 24, 9, 3, 10, 34, 11, 37, 12, 34, 4, 42, 43, 14, 45, 11, 15, 48, 18, 5, 51, 52, 17, 23, 48, 56, 18, 58, 59, 66, 6, 61, 62, 63, 20, 21, 65, 66, 12, 116, 68, 69, 22, 7, 50, 72, 23, 73, 74, 166, 16, 24, 126, 77, 40, 19, 25, 128, 8, 81, 108, 26, 41, 13, 52, 131
Offset: 0

Views

Author

Keywords

Comments

"Containment" implies here that the digits of n are consecutive digits in the square; see A091873 for a relaxed alternative. [R. J. Mathar, Dec 09 2008]

Crossrefs

Programs

  • Mathematica
    Table[ i=0; While[ StringPosition[ ToString[ i^2 ], ToString[ n ] ]=={}, i++ ]; i, {n, 0, 80} ]

A080470 a(n) = smallest composite number that is obtained by placing digits anywhere in n; a(n) = n if n is composite.

Original entry on oeis.org

10, 12, 30, 4, 15, 6, 27, 8, 9, 10, 110, 12, 123, 14, 15, 16, 117, 18, 119, 20, 21, 22, 123, 24, 25, 26, 27, 28, 129, 30, 231, 32, 33, 34, 35, 36, 237, 38, 39, 40, 141, 42, 143, 44, 45, 46, 147, 48, 49, 50, 51, 52, 153, 54, 55, 56, 57, 58, 159, 60, 161, 62, 63, 64, 65, 66, 267
Offset: 1

Views

Author

Amarnath Murthy, Mar 07 2003

Keywords

Crossrefs

Extensions

Corrected and extended by Ray Chandler, Oct 11 2003

A080471 a(n) is the smallest Fibonacci number that is obtained by placing digits anywhere in n; a(n) = n if n is a Fibonacci number.

Original entry on oeis.org

1, 2, 3, 34, 5, 610, 377, 8, 89, 610, 4181, 121393, 13, 144, 1597, 10946, 1597, 4181, 1597, 832040, 21, 514229, 233, 2584, 2584, 28657, 28657, 2584, 121393, 832040, 317811, 832040, 233, 34, 3524578, 46368, 377, 46368, 121393, 832040, 4181, 514229
Offset: 1

Views

Author

Amarnath Murthy, Mar 07 2003

Keywords

Crossrefs

Programs

  • Maple
    IsSubList:= proc(T, S)
      local i;
      if T = [] then return true fi;
      if S = [] then return false fi;
      i:= ListTools:-Search(T[1],S);
      if i = 0 then false else procname(T[2..-1],S[i+1..-1]) fi
    end proc:
    f:= proc(n) local T,S,k,v;
       T:= convert(n,base,10);
       for k from 1 do
          v:= combinat:-fibonacci(k);
          S:= convert(v,base,10);
          if IsSubList(T,S) then return v fi
       od
    end proc:
    map(f, [$1..100]); # Robert Israel, Mar 10 2020
  • Mathematica
    a[n_] := Block[{p = RegularExpression[ StringJoin @@ Riffle[ ToString /@ IntegerDigits[ n], ".*"]], f, k=2}, While[! StringContainsQ[ ToString[f = Fibonacci[ k++]], p]]; f]; Array[a, 42] (* Giovanni Resta, Mar 10 2020 *)
  • Python
    def dmo(n, t):
        if t < n: return False
        while n and t:
            if n%10 == t%10:
                n //= 10
            t //= 10
        return n == 0
    def fibo(f=1, g=2):
        while True: yield f; f, g = g, f+g
    def a(n):
        return next(f for f in fibo() if dmo(n, f))
    print([a(n) for n in range(1, 77)]) # Michael S. Branicky, Jan 21 2023

Extensions

Corrected and extended by Ray Chandler, Oct 11 2003

A080472 a(n) = smallest triangular number that is obtained by placing digits anywhere in n; a(n) = n if n is a triangular number.

Original entry on oeis.org

1, 21, 3, 45, 15, 6, 78, 28, 91, 10, 171, 120, 136, 1431, 15, 136, 171, 1081, 190, 120, 21, 1225, 231, 2145, 253, 276, 276, 28, 2926, 300, 231, 325, 3003, 2346, 325, 36, 378, 378, 3916, 406, 741, 4278, 435, 4465, 45, 406, 4278, 1485, 496, 1540, 351, 528, 153, 1540
Offset: 1

Views

Author

Amarnath Murthy, Mar 07 2003

Keywords

Crossrefs

Programs

  • Python
    from math import isqrt
    from itertools import count
    def dmo(n, t):
        if t < n: return False
        while n and t:
            if n%10 == t%10:
                n //= 10
            t //= 10
        return n == 0
    def a(n):
        return next(t for t in (i*(i+1)//2 for i in count(isqrt(2*n))) if dmo(n, t))
    print([a(n) for n in range(1, 77)]) # Michael S. Branicky, Jan 21 2023

Extensions

More terms from Ray Chandler, Oct 11 2003

A286300 Square root of smallest square formed from n by incorporating all the digits of n in a new decimal number.

Original entry on oeis.org

1, 5, 6, 2, 5, 4, 24, 9, 3, 10, 11, 11, 19, 12, 34, 4, 42, 9, 13, 32, 11, 15, 18, 18, 5, 16, 27, 17, 17, 48, 19, 18, 56, 18, 55, 6, 61, 59, 37, 20, 12, 18, 18, 12, 65, 8, 28, 22, 7, 45, 34, 15, 55, 65, 75, 16, 24, 72, 23, 40, 13, 16, 19, 8, 16, 26, 24, 41, 13
Offset: 1

Views

Author

Michael De Vlieger, May 05 2017

Keywords

Comments

Square root of less restrictive version of A091873: a(n) <= A091873(n).
First difference between a(n) and A091873(n) is for n=13. a(13) = sqrt(361) = 19, while A091873(13) = sqrt(1369) = 37.
If n is square then a(n) = sqrt(n).

Examples

			a(4) = 2 since 4 = 2^2.
Table of the first 20 terms of related sequences:
   n  A068165  A091873  a(n)^2  a(n)
   1:       1        1       1     1
   2:      25        5      25     5
   3:      36        6      36     6
   4:       4        2       4     2
   5:      25        5      25     5
   6:      16        4      16     4
   7:     576       24     576    24
   8:      81        9      81     9
   9:       9        3       9     3
  10:     100       10     100    10
  11:     121       11     121    11
  12:     121       11     121    11
  13:    1369       37     361    19
  14:     144       12     144    12
  15:    1156       34    1156    34
  16:      16        4      16     4
  17:    1764       42    1764    42
  18:    1089       33      81     9
  19:     169       13     169    13
  20:    2025       45    1024    32
...
		

Crossrefs

Programs

  • Mathematica
    Table[If[IntegerQ@ Sqrt@ n, Sqrt@ n, k = Floor@ Sqrt@ n; Function[t, While[Function[w, Times @@ Boole@ Map[w[[#1]] >= #2 & @@ # &, #] < 1]@ DigitCount[k^2] &@ Apply[Join, Map[Lookup[t, #] /. d_ /; IntegerQ@ d :> If[d > 0, {d, #}, {10, #}] &, Keys@ t]], k++]]@ KeyDrop[PositionIndex@ DigitCount@ n, 0]; k], {n, 69}] (* Michael De Vlieger, May 05 2017, Version 10.1 *)
Showing 1-8 of 8 results.