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: Matthew Conroy

Matthew Conroy's wiki page.

Matthew Conroy has authored 11 sequences. Here are the ten most recent ones:

A381708 a(n) is the smallest nonnegative integer k such that sigma_k(n) > sigma_k(j) for all 1 <= j < n.

Original entry on oeis.org

0, 0, 1, 0, 2, 0, 3, 1, 2, 1, 3, 0, 3, 2, 2, 1, 3, 1, 3, 1, 3, 2, 3, 0, 4, 3, 3, 2, 4, 1, 4, 2, 4, 2, 4, 0, 4, 3, 4, 2, 4, 1, 4, 2, 4, 2, 4, 0, 4, 3, 4, 2, 4, 2, 4, 2, 4, 3, 4, 0, 5, 3, 4, 2, 5, 2, 5, 3, 4, 2, 5, 1, 5, 3, 4, 3, 5, 2, 5, 2, 5, 3, 5, 1, 5, 3, 5, 3, 5, 1, 5, 3, 5, 3, 5, 1, 5, 3, 5, 2, 5, 2, 5, 3, 5, 3, 5, 1, 5
Offset: 1

Author

Matthew Conroy, Mar 04 2025

Keywords

Comments

sigma_k(n) is the sum of the k-th powers of the divisors of n.
a(n) exists since one can prove that for k > n*(log 2 + 1/2 log(n-1)), sigma_k sets a record at n.

Examples

			For n = 1, k = 0 is enough so a(1) = 0.
For n = 2, k = 0 works since sigma_0(2) = 2 > 1 = sigma_0(1) so a(2) = 0.
For n = 3, sigma_0(3) = 2 = sigma_0(2), but sigma_1(3) = 1^1+3^1 = 4 > 3 = sigma_1(2) > 1 = sigma_1(1) so a(3) = 1.
For n = 4, sigma_0(4) = 1^0+2^0+4^0 = 3 > 2 = sigma_0(3) = sigma_0(2) > 1 = sigma_0(1) so a(4) = 0.
For n = 5, sigma_0(5) = 2 = sigma_0(2) and sigma_1(5) = 6 < sigma_1(4) = 7 but sigma_2(5) = 26 > sigma_2(4) > sigma_2(3) > sigma_2(2) > sigma_2(1) so a(5) = 2.
		

Programs

  • PARI
    check(n,k) =  my(m=0);for(i=1,n-1, my(s=sigma(i,k)); if(s>m,m=s)); if(sigma(n,k)>m,return(1),return(0));
    a(n) = my(ii=0); while(!check(n, ii), ii++);  ii;

Formula

a(n) = 0 precisely when n is highly composite number A002182.
a(n) = 1 precisely when n is highly abundant A002093 and not highly composite.
a(n) = 2 precisely when n is in A193988 and is not highly composite and is not highly abundant.
a(n) <= m if n < A098475(m). Empirically, it appears that a(A098475(m)) = m+1. - Pontus von Brömssen, Mar 16 2025

A288677 Every element of Z/nZ can be expressed as a sum of no more than a(n) squares.

Original entry on oeis.org

1, 2, 3, 2, 2, 2, 4, 3, 2, 2, 3, 2, 2, 2, 4, 2, 3, 2, 3, 2, 2, 2, 4, 2, 2, 3, 3, 2, 2, 2, 4, 2, 2, 2, 3, 2, 2, 2, 4, 2, 2, 2, 3, 3, 2, 2, 4, 3, 2, 2, 3, 2, 3, 2, 4, 2, 2, 2, 3, 2, 2, 3, 4, 2, 2, 2, 3, 2, 2, 2, 4, 2, 2, 2, 3, 2, 2, 2, 4, 3, 2, 2, 3, 2, 2, 2, 4, 2, 3, 2, 3, 2, 2, 2, 4, 2, 3, 3, 3
Offset: 2

Author

Matthew Conroy, Jun 13 2017

Keywords

Examples

			0^2 = 0 and 1^2 = 1 mod 2, so each element of Z/2Z is a square, so a(2)=1;
0^2 = 0, 1^2 = 2^2 = 1 mod 3, so 2 = 1^2 + 1^2 requires two squares to sum to 2, so a(3)=2.
		

Crossrefs

Cf. A287286.

Programs

  • Mathematica
    a[n_] := Which[n == 2, 1, Mod[n, 4] != 0 && AllTrue[Select[Divisors[n] // Sqrt, IntegerQ], Mod[#, 4] == 1&], 2, Mod[n, 8] != 0, 3, True, 4];
    Table[a[n], {n, 2, 140}] (* Jean-François Alcover, Jun 13 2017 *)
  • PARI
    c(n) = A=factor(n);ok=1;for(i=1,matsize(A)[1],if(A[i,1]%4==3&&A[i,2]>1,ok=0));return(ok); wn(n) = if(n==2,1,if(n%4>0&&c(n)==1,2,if(n%8>0,3,4))); for(ii=2,140,print1(wn(ii),","))

Formula

From Small's paper, theorem 3.1: a(n)=1 if n=2; else a(n)=2 if n != 0 mod 4 and p^2|n implies p=1 mod 4; else a(n)=3 if n!=0 mod 8; else a(n)=4.

A261752 Minimum number of knights on an n X n chessboard such that every square is attacked.

Original entry on oeis.org

6, 7, 8, 10, 14, 18, 22, 25, 28, 32, 36, 43, 48, 54, 58, 66, 70, 78, 84, 91, 98, 107, 112, 123, 128, 139, 146, 156, 164
Offset: 4

Author

Matthew Conroy, Aug 31 2015

Keywords

Comments

Total domination number of n X n knight graph.
Distinct from A006075 since here all squares must be attacked, whereas, in A006075, all squares are either attacked or occupied.
a(34) = 182, a(36) = 202, a(38) = 224. - Andy Huchala, Jun 04 2021

Examples

			An example for the 4 X 4 case:
  ....
  .NNN
  .N..
  NN..
and for the 5 x 5 case:
  .....
  ..N..
  .NN..
  NNN..
  N....
		

Crossrefs

Cf. A006075.

Extensions

a(15)-a(18) from Giovanni Resta, Aug 31 2015
a(19)-a(26) from Andy Huchala, Oct 16 2017
a(27)-a(30) from Andy Huchala, Oct 18 2017
a(31)-a(32) from Andy Huchala, Jun 04 2021

A178830 Number of distinct partitions of {1,...,n} into two nonempty sets P and S with the product of the elements of P equal to the sum of elements in S.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 1, 1, 1, 3, 1, 2, 1, 3, 3, 3, 3, 1, 4, 4, 3, 2, 2, 4, 3, 5, 3, 2, 4, 5, 4, 5, 6, 1, 4, 2, 5, 4, 7, 4, 4, 3, 3, 6, 14, 3, 4, 10, 6, 3, 6, 4, 4, 4, 8, 7, 6, 8, 7, 10, 5, 11, 8, 5, 11, 4, 7, 7, 5, 8, 12, 5, 6, 9, 8, 11, 8, 5, 8, 9, 8, 10, 8, 12, 7, 11, 8, 7, 7, 8, 6, 7, 8, 11, 8, 16, 9, 12, 13, 8
Offset: 1

Author

Matthew Conroy, Dec 31 2010

Keywords

Comments

That the terms are nonzero for n>4 is shown by the fact that for n odd, P={1,(n-1)/2,n-1} works, and for n even, P={1,(n-2)/2,n} works.
a(A207852(n)) = n and a(m) <> n for m < A207852(n). - Reinhard Zumkeller, Feb 21 2012

Examples

			{1,2,3} can be partitioned into P={3} and S={1,2} with 3=1+2.  This is the only such partition, so a(3)=1.
{1,2,3,4,5} can be partitioned into P={1,2,4} and S={3,5} with 1*2*4=3+5.  This is the only such partition, so a(5)=1.
{1,...,10} can be partitioned into subsets P={1,2,3,7} and S={4,5,6,8,9,10} since 1*2*3*7=4+5+6+8+9+10. P can also be taken as P={6,7} or P={1,4,10}, and so there are 3 distinct ways to partition {1,...,10}, and so a(10)=3.
		

References

  • Problem 2826, Crux Mathematicorum, May 2004, 178-179

Programs

  • Haskell
    a178830 1 = 0
    a178830 n = z [1..n] (n * (n + 1) `div` 2) 1 where
       z []     s p             = fromEnum (s == p)
       z (x:xs) s p | s > p     = z xs (s - x) (p * x) + z xs s p
                    | otherwise = fromEnum (s == p)
    -- Reinhard Zumkeller, Feb 21 2012
  • Maple
    b:= proc(n, s, p)
          `if`(s=p, 1, `if`(n<1, 0, b(n-1, s, p)+
          `if`(s-n `if`(n=1, 0, b(n, n*(n+1)/2, 1)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Jun 07 2012
  • Mathematica
    b[, s, s_] = 1; b[n_ /; n < 1, , ] = 0; b[n_, s_, p_] := b[n, s, p] = b[n-1, s, p] + If[s-n < p*n, 0, b[n-1, s-n, p*n]]; a[1] = 0; a[n_] := a[n] = b[n, n*(n+1)/2, 1]; Table[Print[a[n]]; a[n], {n, 1, 100}] (* Jean-François Alcover, Aug 16 2013, after Alois P. Heinz *)
  • PARI
    maxprodset(n)=ii=1;while(ii!+ii*(ii+1)/2
    				

A114061 Numbers n such that n = (product of digits of n) * (sum of digits of n) in some base.

Original entry on oeis.org

0, 1, 6, 12, 16, 20, 30, 42, 48, 54, 56, 72, 90, 96, 110, 128, 132, 135, 144, 156, 160, 162, 176, 182, 210, 231, 240, 250, 272, 300, 306, 324, 336, 342, 380, 384, 420, 432, 448, 455, 462, 480, 495, 504, 506, 540, 552, 576, 600, 624, 650, 663, 686, 702, 720, 750
Offset: 1

Author

Matthew Conroy, Feb 02 2006

Keywords

Comments

This sequence is infinite since b^2+b is in the sequence for all b>1: in base b, b^2+b has digits {1,b} and (1*b)*(1+b)=b^2+b.

Examples

			12 is in the sequence since in base 9, 12 has digits {1,3} and (1*3)*(1+3)=12.
		

Crossrefs

Cf. A038369.

A064693 Number of connected components remaining when decimal expansion of the number n is cut from a piece of paper.

Original entry on oeis.org

2, 1, 1, 1, 2, 1, 2, 1, 3, 2, 2, 1, 1, 1, 2, 1, 2, 1, 3, 2, 2, 1, 1, 1, 2, 1, 2, 1, 3, 2, 2, 1, 1, 1, 2, 1, 2, 1, 3, 2, 3, 2, 2, 2, 3, 2, 3, 2, 4, 3, 2, 1, 1, 1, 2, 1, 2, 1, 3, 2, 3, 2, 2, 2, 3, 2, 3, 2, 4, 3, 2, 1, 1, 1, 2, 1, 2, 1, 3, 2, 4, 3, 3, 3, 4, 3, 4, 3, 5, 4, 3, 2, 2, 2, 3, 2, 3, 2, 4, 3, 3, 2, 2, 2, 3
Offset: 0

Author

Matthew Conroy, Oct 11 2001

Keywords

Examples

			We assume 1,2,3,5 have no hole; 0,4,6,9 have 1 hole; 8 has two holes. So cutting 8 from a piece of paper creates three connected components: one for each hole and one for the remainder of the paper. Hence a(8)=3.
		

Crossrefs

Cf. A064531. Equals A064692 + 1.

A060324 a(n) is the minimal prime q such that n*(q+1)-1 is prime, that is, the smallest prime q so that n = (p+1)/(q+1) with p prime; or a(n) = -1 if no such q exists.

Original entry on oeis.org

2, 2, 3, 2, 3, 2, 5, 2, 5, 2, 3, 3, 7, 2, 3, 2, 3, 2, 5, 2, 3, 5, 5, 2, 5, 3, 3, 2, 5, 2, 13, 3, 3, 2, 3, 2, 11, 2, 5, 5, 3, 3, 5, 2, 3, 2, 5, 3, 5, 2, 19, 5, 3, 7, 7, 2, 3, 2, 5, 2, 7, 11, 3, 2, 5, 2, 5, 3, 11, 5, 3, 5, 13, 5, 5, 2, 3, 2, 7, 2, 7, 5, 3, 2, 5, 2, 3, 2, 17, 2, 7, 3, 5, 2, 3, 3, 11, 2, 5, 5
Offset: 1

Author

Matthew Conroy, Mar 29 2001

Keywords

Comments

A conjecture of Schinzel, if true, would imply that such a q always exists.

Examples

			1 = (2+1)/(2+1), so the first term is 2; 3(2+1) - 1 = 8 which is not prime, yet 3(3+1) - 1 = 11 is prime (3 = (11+1)/(3+1)) so the 3rd term is 3.
		

Crossrefs

Cf. A060424. Values of p are given in A062251.

Programs

  • Haskell
    a060324 n = head [q | q <- a000040_list, a010051' (n * (q + 1) - 1) == 1]
    -- Reinhard Zumkeller, Aug 28 2014
    
  • Maple
    a:= proc(n) local q;
           q:= 2;
           while not isprime(n*(q+1)-1) do
              q:= nextprime(q);
           od; q
        end:
    seq(a(n), n=1..300); # Alois P. Heinz, Feb 11 2011
  • Mathematica
    a[n_] := (q = 2; While[!PrimeQ[n*(q + 1) - 1], q = NextPrime[q]]; q); a /@ Range[100] (* Jean-François Alcover, Jul 20 2011, after Maple prog. *)
  • PARI
    a(n) = {my(q=2); while (!isprime(n*(q+1)-1), q = nextprime(q+1)); q;} \\ Michel Marcus, Nov 20 2017

Formula

a(n) = (A062251(n)+1) / n - 1. - Reinhard Zumkeller, Aug 28 2014

A060424 Record-setting n's for the function q(n), the minimum prime q such that n(q+1)-1 is prime p (i.e., q(n) > q(j) for all 0 < j < n).

Original entry on oeis.org

1, 3, 7, 13, 31, 51, 101, 146, 311, 1332, 2213, 6089, 10382, 11333, 32003, 83633, 143822, 176192, 246314, 386237, 450644, 1198748, 2302457, 5513867, 9108629, 11814707, 16881479, 18786623, 24911213, 28836722, 34257764, 196457309
Offset: 1

Author

Matthew Conroy, Apr 10 2001

Keywords

Examples

			a(3)=7, since q(7)=5 and q(j) < 5 for 0 < j < 7.
		

Crossrefs

Cf. A060324. See A062252 and A062256 for the corresponding values of q and p.

Programs

  • Mathematica
    q[n_] := Module[{p = 2}, While[! PrimeQ[n*(p+1)-1], p = NextPrime[p]]; p]; record = 0; a[0] = 0; a[n_] := a[n] = For[k = a[n-1]+1, True, k++, If[q[k] > record, record = q[k]; Print[k]; Return[k]]]; Table[a[n], {n, 1, 32}] (* Jean-François Alcover, Nov 18 2013 *)

A066419 Numbers k such that k! is not divisible by the sum of the decimal digits of k!.

Original entry on oeis.org

432, 444, 453, 458, 474, 476, 485, 489, 498, 507, 509, 532, 539, 541, 548, 550, 552, 554, 555, 556, 560, 565, 567, 576, 593, 597, 603, 608, 609, 610, 611, 612, 613, 624, 630, 632, 634, 640, 645, 657, 663, 665, 683, 685, 686, 692, 698, 703, 706, 708, 714
Offset: 1

Author

Matthew Conroy, Dec 25 2001

Keywords

Examples

			The sum of the decimal digits of 5! is 1+2+0=3 and 3 divides 120, so 5 is not in the sequence.
The sum of the decimal digits of 432! is 3897 = (9)(433) and 3897 does not divide 432!, so 432 is in the sequence.
		

Crossrefs

Cf. A004152 (sum of digits of n!).

Programs

  • Mathematica
    Select[Range[1000], !Divisible[Factorial[#],Total[IntegerDigits[Factorial[#]]]] &], (* Tanya Khovanova, Jun 13 2021 *)
  • PARI
    isA066419(n) = (Mod(n!, sumdigits(n!)) != 0) \\ Jianing Song, Aug 26 2024
  • Python
    from math import factorial
    def sd(n): return sum(map(int, str(n)))
    def ok(f): return f%sd(f) != 0
    print([n for n in range(1, 715) if ok(factorial(n))]) # Michael S. Branicky, Jun 13 2021
    

A064692 Total number of holes in decimal expansion of the number n, assuming 4 has 1 hole.

Original entry on oeis.org

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

Author

Matthew Conroy, Oct 11 2001

Keywords

Examples

			We assume decimal digits 1,2,3,5,7 have no hole; 0,4,6,9 have one hole each; 8 has two holes. So a(148)=3.
		

Programs

  • Mathematica
    Table[DigitCount[x].{0, 0, 0, 1, 0, 1, 0, 2, 1, 1}, {x, 0, 104}] (* Zak Seidov, Jul 25 2015 *)
  • Python
    def A064692(n):
        x=str(n)
        return x.count("0")+x.count("4")+x.count("6")+x.count("8")*2+x.count("9") # Indranil Ghosh, Feb 02 2017

Formula

a(A001742(n)) = 0. - Michel Marcus, Jul 25 2015