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: David S. Newman

David S. Newman's wiki page.

David S. Newman has authored 70 sequences. Here are the ten most recent ones:

A308834 a(n) is the smallest error in trying to solve n^4 = x^4 + y^4. That is, for each n from 2 on, find positive integers x and y, x <= y < n such that |n^4 - x^4 - y^4| is minimal and let a(n) = n^4 - x^4 - y^4.

Original entry on oeis.org

14, 49, 94, 113, 46, -191, 399, 64, -657, 545, -466, -721, -145, 1328, 270, -2751, 719, -751, 1118, -1376, -1041, 1839, 1310, 1663, 815, 5184, -306, 9104, 863, 1455, 4320, 7024, -5105, 4289, 11504, 64, -12016, 2816, 10799, -11200, 6094, -2671, -226, 20753
Offset: 2

Author

David S. Newman, Jun 27 2019

Keywords

Comments

This sequence was suggested to me by Moshe Shmuel Newman.
This is A135998 with the exponent 4 replacing 3.
From M. F. Hasler, Feb 03 2024: (Start)
Can it happen that (x,y) and (x',y') yield the same minimal absolute difference, but with opposite signs? If so, how is a(n) defined in this case?
Without the condition y < n, the trivial "solution" (x, y) = (1, n) would always yield a(n) = -1. With the condition, there is no admissible pair (x,y) for n = 1, whence a(1) is undefined. (End)

Examples

			Here are the calculations for the first few values.
For 2, the only possible values for x and y are 1,1, so we have
a(2) = 2^4 - 1^4 - 1^4 = 16 - 2 = 14.
For 3, y can be 1 or 2. if y is 1, x is 1 as well, and if y=2, then x can be 1 or 2.
3^4 - 1^4 - 1^4 = 79
3^4 - 1^4 - 2^4 = 64
3^4 - 2^4 - 2^4 = 49.
The smallest absolute value is in the last case, so a(3) = 49.
		

Crossrefs

Cf. A135998 (equivalent for 3rd powers).

Programs

  • Mathematica
    nend = 100;For[n = 2, n <= nend, n++, a[n] = 0];For[n = 2, n <= nend, n++, min = n^4; For[y = 1, y <= n - 1, y++,  For [x = y, x <= n - 1, x++,   changed = False;   sol = n^4 - x^4 - y^4;   If[(sol < min) && (sol > 0), min = sol; changed = True];   If[(Abs[sol] < min) && (sol < 0), min = -sol; changed = True];   If[changed, a[n] = sol]]]]; Print[t = Table[a[i], {i, 2, nend}]] (* or *)
    a[n_] := SortBy[n^4 - Flatten[Table[x^4 + y^4, {x, n-1}, {y, x}]], Abs][[1]]; Array[a, 99, 2] (* Giovanni Resta, Jul 05 2019 *)
  • PARI
    A308834(n, p=4) = { my(np=n^p, m=np); for(y=max(sqrtnint(np\2, p), 1), n-1, my(x = sqrtnint(np - y^p, p), dy = np-y^p, d = if(dy-x^p > (x+1)^p-dy && x < n-1, dy-(x+1)^p, dy-x^p)); abs(d) < abs(m) && abs(m=d) < 2 && break); m} \\ M. F. Hasler, Feb 03 2024

A320297 a(n) = a(n-1-a(a(a(n-1)))) + a(a(a(a(n-1)))) for n > 1, a(n) = n for n < 2.

Original entry on oeis.org

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

Author

David S. Newman, Oct 09 2018

Keywords

Comments

This sequence hits every positive integer.

Crossrefs

Cf. A320063.

Programs

  • GAP
    a:=[1,1];; for n in [3..80] do a[n]:=a[n-1-a[a[a[n-1]]]]+a[a[a[a[n-1]]]]; od; Concatenation([0],a); # Muniru A Asiru, Oct 28 2018
  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := a[n] = +a[n - 1 - a[a[n - 1]]] + a[a[a[n - 1]]];
    Table[a[i], {i, 1, 300}]

Formula

a(n+1) - a(n) = 0 or 1 for all n >= 0.

A320063 A sequence which changes by one or zero: a(n) = a(n-1-a(a(n-1))) + a(a(a(n-1))) for n > 1, a(n) = n for n < 2.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 8, 8, 9, 10, 10, 10, 10, 11, 12, 12, 13, 13, 13, 13, 14, 15, 15, 15, 16, 17, 17, 17, 17, 18, 19, 19, 19, 20, 20, 21, 21, 21, 21, 21, 22, 23, 23, 23, 24, 24, 25, 26, 27, 27, 27, 27, 27, 28, 28, 29, 29, 29
Offset: 0

Author

David S. Newman, Oct 04 2018

Keywords

Comments

This is similar to a problem that I had in the Monthly 35 years ago. The solution then was by Daniel Kleitman.

Crossrefs

Cf. A093878.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          a(n-1-a(a(n-1)))+a(a(a(n-1))))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Oct 08 2018
  • Mathematica
    f[0] = 0;
    f[1] = 1;
    f[n_] := f[n] = +f[n - 1 - f[f[n - 1]]] + f[f[f[n - 1]]];
    Table[f[i], {i, 1, 30}]

A318756 Total number of binary digits used to write all partitions of n in binary notation.

Original entry on oeis.org

1, 4, 8, 18, 30, 55, 85, 141, 211, 324, 467, 691, 968, 1377, 1898, 2631, 3554, 4830, 6425, 8578, 11272, 14819, 19243, 25005, 32133, 41279, 52585, 66907, 84512, 106636, 133685, 167377, 208439, 259145, 320696, 396251, 487532, 598881, 732990, 895627, 1090752
Offset: 1

Author

David S. Newman, Sep 02 2018

Keywords

Examples

			For n = 3 there are 3 partitions which when written in binary are: 11, 10+1, 1+1+1, for a total of 8 binary integers.
		

Crossrefs

Programs

  • Maple
    h:= proc(n) option remember; 1+ilog2(n) end:
    b:= proc(n, i) option remember; `if`(n=0, [1, 0],
          `if`(i<1, 0, b(n, i-1)+(p-> p+[0, p[1]*
            h(i)])(b(n-i, min(n-i, i)))))
        end:
    a:= n-> b(n$2)[2]:
    seq(a(n), n=1..60);  # Alois P. Heinz, Sep 27 2018
  • Mathematica
    h[n_] := h[n] = 1 + Log[2, n] // Floor;
    b[n_, i_] := b[n, i] = If[n == 0, {1, 0}, If[i < 1, 0, b[n, i - 1] + Function[p, p + {0, p[[1]]*h[i]}][b[n - i, Min[n - i, i]]]]];
    a[n_] := b[n, n][[2]];
    a /@ Range[1, 60] (* Jean-François Alcover, Sep 16 2019, after Alois P. Heinz *)
    Table[Length[Flatten[IntegerDigits[#,2]&/@IntegerPartitions[n]]],{n,50}] (* Harvey P. Dale, Aug 14 2021 *)
  • PARI
    a(n)={subst(deriv(polcoef(1/prod(k=1, n, 1 - x^k*y^(logint(k,2) + 1) + O(x*x^n)), n)), y, 1)} \\ Andrew Howroyd, Sep 07 2018

A319140 Total number of binary digits in all partitions of n into distinct parts.

Original entry on oeis.org

1, 2, 5, 6, 11, 17, 23, 30, 44, 60, 76, 102, 128, 166, 214, 264, 327, 413, 502, 618, 759, 917, 1105, 1335, 1598, 1907, 2279, 2702, 3191, 3776, 4436, 5198, 6101, 7113, 8292, 9653, 11188, 12951, 14984, 17277, 19889, 22881, 26248, 30073, 34439, 39320, 44850
Offset: 1

Author

David S. Newman, Sep 11 2018

Keywords

Examples

			For n = 4 there are 2 partitions into distinct parts in binary they are: 100, 11+1, for a total of 6 binary parts.
		

Crossrefs

Programs

  • Maple
    h:= proc(n) option remember; 1+ilog2(n) end:
    b:= proc(n, i) option remember; `if`(n=0, [1, 0],
          `if`(n>i*(i+1)/2, 0, b(n, i-1)+(p-> p+h(i)
           *[0, p[1]])(b(n-i, min(n-i, i-1)))))
        end:
    a:= n-> b(n$2)[2]:
    seq(a(n), n=1..60);  # Alois P. Heinz, Sep 27 2018
  • Mathematica
    h[n_] := h[n] = 1+Log[2, n] // Floor;
    b[n_, i_] := b[n, i] = If[n == 0, {1, 0}, If[n > i*(i+1)/2, 0, b[n, i-1] + Function[p, p + h[i]*{0, p[[1]]}][b[n-i, Min[n-i, i-1]]]]];
    a[n_] := b[n, n][[2]];
    a /@ Range[1; 60] (* Jean-François Alcover, Sep 28 2019, after Alois P. Heinz *)
  • PARI
    seq(n)={[subst(deriv(p,y), y, 1) | p<-Vec(-1 + prod(k=1, n, 1 + x^k*y^(logint(k,2)+1) + O(x*x^n)))]} \\ Andrew Howroyd, Sep 17 2018

A319142 Total number of binary digits in the partitions of n into odd parts.

Original entry on oeis.org

1, 2, 5, 7, 12, 19, 26, 36, 52, 71, 92, 124, 158, 204, 265, 331, 413, 522, 641, 791, 976, 1184, 1435, 1741, 2093, 2506, 3005, 3574, 4237, 5030, 5928, 6971, 8202, 9593, 11212, 13087, 15210, 17653, 20472, 23665, 27308, 31488, 36205, 41570, 47701, 54584, 62387
Offset: 1

Author

David S. Newman, Sep 11 2018

Keywords

Crossrefs

Programs

  • Maple
    h:= proc(n) option remember; 1+ilog2(n) end:
    b:= proc(n, i) option remember; `if`(n=0, [1, 0],
          `if`(i<1, 0, b(n, i-1-irem(i, 2))+`if`(i::even
           or i>n, 0, (p-> p+[0, p[1]*h(i)])(b(n-i, i)))))
        end:
    a:= n-> b(n$2)[2]:
    seq(a(n), n=1..60);  # Alois P. Heinz, Sep 27 2018
  • Mathematica
    h[n_] := h[n] = 1 + Floor@Log[2, n];
    b[n_, i_] := b[n, i] = If[n==0, {1, 0}, If[i<1, 0, b[n, i-1-Mod[i, 2]] + If[EvenQ[i] || i>n, 0, Function[p, p + {0, p[[1]] h[i]}][b[n - i, i]]]]];
    a[n_] := b[n, n][[2]];
    Array[a, 60] (* Jean-François Alcover, Dec 12 2020, after Alois P. Heinz *)

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

A318632 Let a partition of n be written in binary. Join any two binary ones which are adjacent horizontally or vertically. If all the binary ones are connected count this partition in a(n).

Original entry on oeis.org

1, 2, 2, 4, 3, 5, 5, 9, 8, 11, 12, 17, 16, 21, 24, 34, 34, 43, 47, 61, 65, 82, 92, 116, 124, 147, 166, 200, 220, 262, 293, 350, 383, 449, 504, 592, 654, 756, 846, 983, 1089, 1252, 1396, 1607, 1777, 2033, 2260, 2590, 2871, 3261, 3634, 4116, 4563, 5145, 5722, 6454, 7154, 8032, 8903, 9989, 11039
Offset: 1

Author

David S. Newman, Aug 30 2018

Keywords

Examples

			The partition of 7 = 3 + 2 + 2 looks like this in binary:
  11
  10
  10
The binary ones are adjacent so this partition is counted in a(7).
The partition 7 = 5 + 2 looks like this in binary:
  101
   10
Since the binary ones are not adjacent horizontally or vertically this partition is not counted in a(7).
		

References

  • George E. Andrews, The Theory of Partitions, Addison-Wesley, Reading, Mass., 1976.
  • G. E. Andrews and K. Ericksson, Integer Partitions, Cambridge University Press 2004.

Extensions

a(9)-a(61) from Robert Price, Sep 06 2018

A316996 Consider a partition of n into distinct parts with the summands written in binary notation. a(n) is the number of such partitions whose binary representation has an odd number of binary ones.

Original entry on oeis.org

0, 1, 1, 0, 2, 1, 1, 5, 2, 2, 7, 6, 6, 12, 10, 8, 23, 19, 15, 37, 27, 32, 60, 42, 54, 87, 74, 88, 130, 116, 134, 206, 173, 203, 305, 256, 325, 437, 375, 485, 624, 574, 700, 879, 836, 1008, 1268, 1190, 1433, 1773, 1688, 2059, 2443, 2376, 2883, 3362, 3356, 3978
Offset: 0

Author

David S. Newman, Jul 18 2018

Keywords

Examples

			For n = 5 there are 3 partitions to be examined: 5, 4+1, and 3+2. In binary these are 101, 100+1, and 11+10, which have 2, 2, and 3 binary ones respectively, so a(5) = 1.
		

Crossrefs

Programs

  • Maple
    h:= proc(n) option remember; `if`(n=0, 0, irem(n, 2, 'q')+h(q)) end:
    b:= proc(n, i, t) option remember; `if`(i*(i+1)/2 b(n$2, 0):
    seq(a(n), n=0..100);  # Alois P. Heinz, Jul 24 2018
  • Mathematica
    h[n_] := h[n] = If[n == 0, 0, Mod[n, 2] + h[Quotient[n, 2]]];
    b[n_, i_, t_] := b[n, i, t] = If[i*(i + 1)/2 < n, 0, If[n == 0, t, b[n, i - 1, t] + b[n - i, Min[n - i, i - 1], Mod[t + h[i], 2]]]];
    a[n_] := b[n, n, 0];
    a /@ Range[0, 100] (* Jean-François Alcover, Sep 16 2019, after Alois P. Heinz *)
  • PARI
    seq(n)={apply(t->polcoeff(lift(t), 1), Vec(prod(i=1, n, 1 + x^i*Mod( y^hammingweight(i), y^2-1 ) + O(x*x^n))))} \\ Andrew Howroyd, Jul 23 2018

Formula

a(n) + A317239(n) = A000009(n).
a(n) ~ exp(Pi*sqrt(n/3)) / (8 * 3^(1/4) * n^(3/4)). - Vaclav Kotesovec, Oct 09 2018

A305937 Number of partitions such that the least positive integer which is not a part of the partition is prime.

Original entry on oeis.org

0, 1, 1, 2, 3, 5, 6, 10, 13, 19, 26, 36, 47, 65, 84, 111, 144, 188, 239, 309, 390, 497, 624, 786, 978, 1224, 1513, 1875, 2306, 2839, 3469, 4246, 5162, 6279, 7600, 9196, 11077, 13344, 16006, 19191, 22934, 27387, 32602, 38788, 46015, 54547, 64504, 76209, 89835
Offset: 0

Author

David S. Newman, Jun 14 2018

Keywords

Examples

			For n=3 there are three unrestricted partitions: 3, 2+1, and 1+1+1. The least positive integer not in the first partition is 1. One is not a prime so the first partition is not counted. For the second partition the smallest missing positive integer is 3, which is prime. For the third partition the missing number is 2, which is prime. So a(3)=2.
		

Crossrefs

Cf. A000040.

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(n=0,
          `if`(t or isprime(i), 1, 0), `if`(i>n, 0,
          `if`(t or isprime(i), b(n, i+1, true), 0)+
           add(b(n-i*j, i+1, t), j=1..n/i)))
        end:
    a:= n-> b(n, 1, false):
    seq(a(n), n=0..70);  # Alois P. Heinz, Jun 16 2018
  • Mathematica
    nend = 30;
    For[n = 1, n <= nend, n++,
      sum[n] = 0;
      partition = {n};
      For[i = 1, i <= PartitionsP[n], i++,
       partition = NextPartition[partition];
       mex = Min[Complement[Range[n + 1], partition]];
       If [PrimeQ[mex], sum[n]++;]    ] ];
    Table[sum[i], {i, 1, nend}]