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.

User: Rick L. Shepherd

Rick L. Shepherd's wiki page.

Rick L. Shepherd has authored 641 sequences. Here are the ten most recent ones:

A338112 Least number that is both the sum and product of n distinct positive integers.

Original entry on oeis.org

1, 3, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800, 87178291200, 1307674368000, 20922789888000, 355687428096000, 6402373705728000, 121645100408832000, 2432902008176640000, 51090942171709440000, 1124000727777607680000
Offset: 1

Author

Rick L. Shepherd, Oct 10 2020

Keywords

Comments

Each a(n) = n! except that a(2) = 1+2 = 3. For n > 0, only each integer >= A000217(n) is the sum of n distinct positive integers. For the integers that are products of these types, see below.

Examples

			a(1) = 1 because we define sums and products as sum(m) := prod(m) := m for all integers m in this case where these normally-binary operations only have one operand.
a(3) = 6 because 6 = 1+2+3 = 1*2*3 (with all the distinct positive integers the same in the sum and the product only for this term and a(1)).
a(5) = 120 because 120 = 1+2+3+4+110 (= ... = 22+23+24+25+26) = 1*2*3*4*5.
		

Crossrefs

Cf. Products of k distinct positive integers: A000027 (k=1), A020725 (k=2), A080257 (k=3), A122181 (k=4).

Programs

  • Mathematica
    Array[If[# <= 2, (#^2 - #)/2 &[# + 1], #!] &, 22] (* Michael De Vlieger, Oct 15 2020 *)
    With[{nn=30},Rest[CoefficientList[Series[x (2+x-x^2)/(2(1-x)),{x,0,nn}],x] Range[0,nn]!]] (* Harvey P. Dale, Aug 10 2021 *)
  • PARI
    a(n) = if(n<1, , if(n==2, 3, n!))

Formula

a(n) = A000142(n) for n = 1 and n > 2; a(2) = 3.
a(n) = max(A000142(n), A000217(n)).
E.g.f.: x*(2 + x - x^2)/(2*(1 - x)). - Stefano Spezia, Oct 11 2020

A330934 Decimal expansion of the area of a sofa that can be moved around a 90-degree turn both to the right and to the left in a hallway of unit width.

Original entry on oeis.org

1, 6, 4, 4, 9, 5, 5, 2, 1, 8, 4, 2, 5, 4, 4, 0, 8, 5, 1, 6, 6, 8, 8, 0, 9, 3, 4, 7, 6, 0, 0, 6, 3, 3, 6, 8, 5, 1, 9, 4, 2, 5, 2, 8, 6, 4, 0, 9, 8, 9, 6, 2, 6, 3, 6, 8, 8, 9, 3, 4, 5, 7, 0, 8, 0, 1, 0, 3, 2, 9, 9, 1, 0, 8, 1, 5, 3, 7, 7, 9, 2, 9, 1, 9, 2, 7, 2, 5, 9, 1, 4, 9, 2, 0, 7, 5, 4, 4, 6, 7, 7, 2, 9, 0, 8
Offset: 1

Author

Rick L. Shepherd, Jan 03 2020

Keywords

Comments

According to Dan Romik, this may be the largest possible area of such a sofa. He gives the closed-form formula below for the area of this shape which consists of "18 distinct pieces, each of which is given by a separate formula obtained as the solution of some differential equation." See the D. Romik link for a picture of this shape and animations of this and related sofas.

Examples

			1.644955218425440851668809347600633685194252864098962636889345708010329...
		

Crossrefs

Programs

  • Mathematica
    RealDigits[(3 + 2*Sqrt[2])^(1/3) + (3 - 2*Sqrt[2])^(1/3) - 1 + ArcTan[((Sqrt[2] + 1)^(1/3) - (Sqrt[2] - 1)^(1/3))/2], 10, 120][[1]] (* Amiram Eldar, Jun 18 2023 *)
  • PARI
    {default(realprecision, 200);
    my(sr2 = sqrt(2)); (3+2*sr2)^(1/3) + (3-2*sr2)^(1/3) - 1 + atan(((sr2+1)^(1/3) - (sr2-1)^(1/3))/2)}

Formula

Equals (3 + 2*sqrt(2))^(1/3) + (3 - 2*sqrt(2))^(1/3) - 1 + atan(((sqrt(2) + 1)^(1/3) - (sqrt(2) - 1)^(1/3))/2) [D. Romik].

A308086 Carmichael numbers c such that c-4, c-2 and c+2 are primes.

Original entry on oeis.org

656601, 11512252145095521, 35151891169379601, 89283676825965441, 209606994019068801, 584047819872236721, 627126355430628801, 1107574117930742001, 1152431453119654401, 2990125943388676401, 6919232969930803761
Offset: 1

Author

Rick L. Shepherd, May 11 2019

Keywords

Comments

Subsequence of A287591 (Carmichael numbers that are arithmetic means of cousin primes). Calculated from Amiram Eldar's table in that sequence. The Carmichael numbers here are contained within intervals defined by prime triples of the form (p, p+2, p+6); therefore, for each term, four consecutive odd numbers are prime, prime, Carmichael number (divisible by 3), then prime. None of the terms of A287591 available so far are contained within intervals defined by prime triplets of the form (p, p+4, p+6). Is that possible? If so, is it also possible for a Carmichael number to be immediately preceded and succeeded by twin primes, i.e., to be "contained" in a prime quadruplet? (Such Carmichael numbers would necessarily be multiples of 15.)

Examples

			656601 = 3*11*101*197 is a term because 656597 and 656599 are twin primes, 656601 is a Carmichael number, and 656603 is also a prime.
		

Extensions

More terms from Amiram Eldar, Jul 02 2019

A306099 Number of plane partitions of n where parts are colored in 2 colors.

Original entry on oeis.org

1, 2, 10, 34, 122, 378, 1242, 3690, 11266, 32666, 94994, 267202, 754546, 2072578, 5691514, 15364290, 41321962, 109634586, 290048746, 758630698, 1977954706, 5111900410, 13161995010, 33645284962, 85727394018, 217042978882, 547750831210, 1375147078146, 3441516792442
Offset: 0

Author

M. F. Hasler and Rick L. Shepherd, following an idea from David S. Newman, Sep 22 2018

Keywords

Comments

a(0) = 1 corresponds to the empty sum, in which all terms are colored in one among two given colors, since there is no term at all.

Examples

			For n = 1, there is only the partition [1], which can be colored in any of the two colors, whence a(1) = 2.
For n = 2, there are the partitions [2], [1,1] and [1;1]. Adding colors, this yields a(2) = 2 + 4 + 4 = 10 distinct possibilities.
		

Crossrefs

Column 2 of A306100 and A306101. See A306093 .. A306096 for columns 3 .. 6.

Programs

  • PARI
    a(n)=!n+sum(k=1,n,A091298(n,k)<
    				

Formula

a(n) = Sum_{k=1..n} A091298(n,k)*2^k.

Extensions

a(12) corrected and a(13)-a(28) added by Alois P. Heinz, Sep 24 2018

A305445 Minimum number of bit inversions to convert n into a prime.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 1, 1, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 2, 1, 2, 1, 1, 0, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 2, 1, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 2, 1, 1, 0, 2, 1, 1, 0, 3, 2, 2, 1, 1, 0, 2, 1, 2, 1, 2, 1, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1
Offset: 2

Author

Rick L. Shepherd, Aug 12 2018

Keywords

Comments

If n is already a prime, a(n) is defined to be 0. Every original bit of n's binary representation is allowed to be inverted, but no leading 0 bits may be. Every n > 1 is either a prime or can be converted to a prime by bit inversions (guaranteed because, say, 0...010 is the prime 2). The maximum value of the first 10^7 terms is 3.
This sequence was inspired by the linked "code golf" problem, which converts n to a square but (unlike this sequence) disallows inverting n's most significant bit.
The least n for which a(n) = 4 is n = 45812984490. - Giovanni Resta, Jan 03 2019

Examples

			For n = 8, the binary representation 1000 cannot be turned into a prime with only one bit inversion, but 0010, where both the first and third bits from the left are inverted, is the prime 2, so a(8) = 2. (There are other primes possible with two inversions in this case: 1011 (11 decimal) and 1101 (13 decimal).)
		

Programs

  • Maple
    f:= proc(n) local m,d,x;
      if isprime(n) then return 0 fi;
      m:= ilog2(n);
      for d from 1 do
        for x in combinat:-choose([$0..m],d) do
          if isprime(Bits:-Xor(n, add(2^i,i=x))) then return d fi
      od od
    end proc:
    map(f, [$2..200]); # Robert Israel, Aug 20 2018
  • PARI
    {a(n) = my(b, L, N, s, v); if(n < 2, ,
    if(isprime(n), 0, b = binary(n); L = #b; for(j = 1, L, v = vector(j, Y, [1, L]);
    forvec(X = v, N = n + sum(k = 1, j, if(b[X[k]], s = -1, s = 1); s*2^(L - X[k])); if(isprime(N), return(j)), 2))))}

A304453 An expanded binary notation for n: the normal binary expansion for n is expanded by mapping each 1 to 10 and retaining the existing 0's.

Original entry on oeis.org

0, 10, 100, 1010, 1000, 10010, 10100, 101010, 10000, 100010, 100100, 1001010, 101000, 1010010, 1010100, 10101010, 100000, 1000010, 1000100, 10001010, 1001000, 10010010, 10010100, 100101010, 1010000, 10100010, 10100100, 101001010, 10101000, 101010010, 101010100, 1010101010, 1000000, 10000010, 10000100
Offset: 0

Author

Rick L. Shepherd, May 12 2018

Keywords

Comments

This notation is used by Penrose for specifying Turing machine examples. In general, this notation is much more compact than unary. Because no number encoded by this notation contains two or more consecutive 1's, there are an infinite number of additional strings available such as 110, 1110, 11110, ... for specifying delimiters (in lists of numbers), operations, etc. In some contexts, zero may alternately be represented by no symbol at all, for example, when there are two immediately-consecutive delimiters (commas).

Examples

			a(3) = 1010 because 3 in binary is A007088(3) = 11 and each 1 has been replaced by 10 here. Similarly, a(4) = 1000 because A007088(4) = 100 and the expansion adds another 0 after the 1.
		

References

  • R. Penrose, The Emperor's New Mind, Oxford, 1989, pp. 42-46.

Crossrefs

Cf. A007088.

Programs

  • Maple
    a:= n-> (l-> parse(cat(seq(10*l[-i], i=1..nops(l)))))(convert(n, base, 2)):
    seq(a(n), n=0..42);  # Alois P. Heinz, Jan 08 2021
  • Mathematica
    Table[FromDigits[Flatten[IntegerDigits[n,2]/.(1->{1,0})]],{n,0,40}] (* Harvey P. Dale, Sep 07 2019 *)
  • PARI
    {a(n) = my(B, k);
            if(n >= 0,
              B = List(binary(n)); k = 1;
              while(k <= #B,
                if(B[k] == 1,
                  k++; listinsert(B, 0, k));
                k++);
              sum(k = 1, #B, B[k]*(10^(#B - k))))}
    
  • Python
    def a(n): return int(bin(n)[2:].replace('1', '10'))
    print([a(n) for n in range(35)]) # Michael S. Branicky, Jan 08 2021

A297825 a(n) is the (negative) length of the final string after iteratively removing all runs from the binary string 11011100...n (formed by concatenating the first n binary numbers, see A058935(n)).

Original entry on oeis.org

1, -1, -1, -1, -4, -2, -2, -2, -2, 2, 4, 4, 2, 3, 3, 3, 3, 4, 5, 7, 2, 4, 6, 6, 7, 6, 5, 5, 5, 5, 5, 5, 5, 6, 7, 6, 4, 6, 7, 9, 7, 1, -3, -2, -1, -1, 0, 0, 1, 2, 2, 0, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 2, 1, 1, -2, 0, 1, 3, 1, 0, -2, -6, 1, -2, -5, -4, -4, -3, -4, -4, -3, -3, -3, -3, -4, -5, -5, -6
Offset: 1

Author

Rick L. Shepherd, Jan 07 2018

Keywords

Comments

There are exactly three cases: The final string may have length zero, in which case a(n) = 0. If the final string begins 0101... (bits are an initial segment of A000035), a(n) is negative. Otherwise, the final string begins 1010... (bits are an initial segment of A059841) and a(n) is positive. Thus |a(n)| always gives the actual string length (number of terms in the segment).
Of interest is the frequency of sign changes and 0 terms as n becomes large. The largest values of n in the current b-file such that a(n) = 0 are 8612 and 9899.

Examples

			a(21) = 2 because the final string after iteratively removing all runs of two or more identical bits from 11011100...10101 is 10 of length two (as shown in the A297824 example). This term is positive because the first bit of 10 is 1.
		

Crossrefs

Programs

  • PARI
    \\ See the program given in A297824.

A297824 The number of iterations to remove all runs from the binary string 11011100...n (formed by concatenating the first n binary numbers, see A058935(n)).

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 10, 10, 10, 10, 10, 10, 9, 8, 8, 10, 7, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 10, 9, 10, 9, 10, 10, 8, 9, 9, 10, 10, 9, 7, 9, 10, 10, 10, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Offset: 1

Author

Rick L. Shepherd, Jan 06 2018

Keywords

Comments

Each iteration removes all runs of two or more identical bits that appear at the beginning of that iteration. By definition, the bits of the final string will be an initial segment, possibly empty, of 0, 1, 0, 1, ... (A000035) or 1, 0, 1, 0, ... (A059841). A297825 gives the lengths of the final strings; the sign of each nonzero term indicates which case occurs.

Examples

			a(21) = 6 because 1101110010111011110001001101010111100110111101111100001000110010100111010010101 --> 01001010100011010110101 --> 01101010100101 --> 0010101101 -->  101001 --> 1011 --> 10, where each arrow points to the result of one iteration.
		

Crossrefs

Programs

  • PARI
    {remove_runs(v) = my(w, run_found = 0);
    if(#v == 1, w = v, w = []);
    for(k = 2, #v,
       if(v[k-1] == v[k],
         run_found = 1,
         if(run_found == 0, w = concat(w, v[k-1]), run_found = 0);
         if(k == #v, w = concat(w, v[k]))
       )
    ); w}
    {a(n) = my(v = [], L,  c = 0); \\ remove "write(...);" if don't need other b-file
    for(k = 1, n, v = concat(v, binary(k)));
    L = #v;
    while(1,
      v = remove_runs(v);
      if(#v == L, write("b297825.txt", n, " ", L*(if(L == 0, 0, 2*v[1] - 1))); break, L = #v);
      c++
    ); c}
    for(n = 1, 10000, write("b297824.txt", n, " ", a(n))) \\ created two b-files

A281147 a(n) is the maximum number of moves available to one side from a legal chess position with n pieces with promoted pieces allowed.

Original entry on oeis.org

8, 35, 60, 85, 108, 127
Offset: 2

Author

Rick L. Shepherd, Jan 15 2017

Keywords

Comments

For this sequence, unlike A275360, extra pieces from Pawn promotion are allowed in the original positions. For move counts, both of these sequences allow four promotion moves (to Knight, Bishop, Rook, or Queen) per Pawn per promotion square.
Clearly a(n) >= A275360(n) for all 2 <= n <= 32. Additional terms, positions, and proof games showing the legality of the positions -- especially for the larger n -- are desired for both of these sequences. - Rick L. Shepherd, Dec 31 2017

Examples

			White has 8 + 27 + 25 + 25 + 23 = 108 possible moves in the legal position with White King on b5, White Queens on c7, d4, e6, and f3, and Black King on g5. Because there are 6 total pieces on the board and no other legal position with 6 pieces has more than 108 moves available for one side, a(6) = 108.
		

Crossrefs

Cf. A275360.

A280992 Squarefree triangular numbers that are products of consecutive primes.

Original entry on oeis.org

1, 3, 6, 15, 105, 210, 255255
Offset: 1

Author

Rick L. Shepherd, Jan 13 2017

Keywords

Comments

No more terms up to the 5000000th triangular number.
If a(8) exists, it's divisible by a prime p > prime(2000) = 17389. - David A. Corneth, Oct 21 2017

Examples

			The triangular number 255255 = 714*715/2 is a term because 255255 = 3*5*7*11*13*17 is a product of distinct consecutive primes.
1 (the empty product) is a term, so is 3 (the product of just one triangular number).
		

Crossrefs

Programs

  • Maple
    # reuses code of A097889 and A061304
    isA280992 := proc(n)
        isA097889(n) and isA061304(n) ;
    end proc:
    for t from 0 do
        n := t*(t+1)/2 ;
        if isA280992(t) then
            print(t) ;
        end if;
    end do: # R. J. Mathar, Oct 20 2017
  • Mathematica
    Select[PolygonalNumber@ Range[10^5], And[NoneTrue[#[[All, -1]], # > 1 &], Union@ Differences[PrimePi[#[[All, 1]] ] ] == {1}] &@ FactorInteger@ # &] (* Michael De Vlieger, Oct 06 2017 *)
  • PARI
    is(n) = my(f=factor(n)[, 1]); for(k=1, #f-1, if(f[k+1]!=nextprime(f[k]+1), return(0))); ispolygonal(n, 3) && issquarefree(n)
    search(start) = if(start < 4, if(start < 2, print1(1, ", ")); print1(3, ", ")); forcomposite(c=start, , if(is(c), print1(c, ", ")))
    /* Start a search from 1 upwards as follows: */
    search(1) \\ Felix Fröhlich, Oct 21 2017 [Corrected Jun 10, 2019]
    
  • PARI
    uptoprime(n) = {my(prim = vector(n), i = 2, res = List([1]));  prim[1] = 2; forprime(p = 3, , prim[i] = prim[i - 1] * p; i++; if(i>n, break));
    for(i=1, n, if(issquare(8 * prim[i] + 1), listput(res, prim[i])); for(j=1, i-1, c = prim[i]/prim[j]; if(issquare(8 * c + 1), listput(res, c)))); listsort(res); res} \\ David A. Corneth, Oct 21 2017

Extensions

1 and 3 prepended by David A. Corneth, Oct 21 2017