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

A322036 a(n) = A322035(n) - A322034(n).

Original entry on oeis.org

1, 1, 2, 1, 4, 1, 6, 1, 5, 2, 10, 1, 12, 3, 3, 1, 16, 5, 18, 1, 13, 5, 22, 1, 19, 6, 14, 3, 28, 3, 30, 1, 7, 8, 27, 5, 36, 9, 25, 1, 40, 13, 42, 5, 8, 11, 46, 1, 41, 19, 11, 3, 52, 7, 43, 3, 37, 14, 58, 3, 60, 15, 34, 1, 51, 7, 66, 4, 15, 27, 70
Offset: 1

Views

Author

Keywords

Comments

Let s be the fraction defined in A322034 and A322035. Then for n >= 2, 1-s is a(n)/A322035(n).
Note that a(n) >= 1, see A322034.

Examples

			Let s be the fraction defined in A322034 and A322035. The fractions 1-s for n >= 2 are 1/2, 2/3, 1/4, 4/5, 1/3, 6/7, 1/8, 5/9, 2/5, 10/11, 1/6, 12/13, 3/7, 3/5, 1/16, 16/17, 5/18, 18/19, 1/5, 13/21, 5/11, 22/23, 1/12, 19/25, 6/13, 14/27, ...
		

Crossrefs

Programs

  • Maple
    # This generates the terms starting at n=2:
    P:=proc(n) local FM: FM:=ifactors(n)[2]: seq(seq(FM[j][1], k=1..FM[j][2]), j=1..nops(FM)) end: # A027746
    f0:=[]; f1:=[]; f2:=[];
    for n from 2 to 120 do
    a:=0; b:=1; t1:=[P(n)];
    for i from 1 to nops(t1) do b:=b/t1[i]; a:=a+b; od;
    f0:=[op(f0),a]; f1:=[op(f1), numer(a)]; f2:=[op(f2),denom(a)]; od:
    f0;    # s
    f1;    # A322034
    f2;    # A322035
    f2-f1; # A322036
  • Mathematica
    f[x_] := Flatten[ConstantArray[#1, #2] & @@@ FactorInteger[x]]; {1}~Join~Table[Denominator[#] - Numerator[#] &@ Total@ Table[1/Times @@ #[[;; i]], {i, Length[#]}] &@ f[n], {n, 2, 120}] (* Michael De Vlieger, Jun 20 2025 *)

A006022 Sprague-Grundy (or Nim) values for the game of Maundy cake on an n X 1 sheet.

Original entry on oeis.org

0, 1, 1, 3, 1, 4, 1, 7, 4, 6, 1, 10, 1, 8, 6, 15, 1, 13, 1, 16, 8, 12, 1, 22, 6, 14, 13, 22, 1, 21, 1, 31, 12, 18, 8, 31, 1, 20, 14, 36, 1, 29, 1, 34, 21, 24, 1, 46, 8, 31, 18, 40, 1, 40, 12, 50, 20, 30, 1, 51, 1, 32, 29, 63, 14, 45, 1, 52, 24, 43, 1, 67, 1, 38, 31, 58, 12, 53, 1
Offset: 1

Views

Author

Keywords

Comments

There are three equivalent formulas for a(n). Suppose n >= 2, and let p1 <= p2 <= ... <= pk be the prime factors of n, with repetition.
Theorem 1: a(1) = 0. For n >= 2, a(n) = n*s(n), where
s(n) = 1/p1 + 1/(p1*p2) + 1/(p1*p2*p3) + ... + 1/(p1*p2*...*pk).
This is implicit in Berlekamp, Conway and Guy, Winning Ways, 2 vols., 1982, pp. 28, 53.
Note that s(n) = A322034(n) / A322035(n).
David James Sycamore observed on Nov 24 2018 that Theorem 1 implies a(n) < n for all n (see comments in A322034), and also leads to a simple recurrence for a(n):
Theorem 2: a(1) = 0. For n >= 2, a(n) = p*a(n/p) + 1, where p is the largest prime factor of n.
Proof. (Th. 1 implies Th. 2) If n is a prime, Theorem 1 gives a(n) = 1 = n*a(1)+1. For a nonprime n, let n = m*p where p is the largest prime factor of n and m >= 2. From Theorem 1, a(m) = m*s(m), a(n) = q*m*(s(m) + 1/n) = q*a(m) + 1.
(Th. 2 implies Th. 1) The reverse implication is equally easy.
Theorem 2 is equivalent to the following more complicated recurrence:
Theorem 3: a(1) = 0. For n >= 2, a(n) = max_{p|n, p prime} (p*a(n/p)+1).

Examples

			For n=24, s(24) = 1/2 + 1/4 + 1/8 + 1/24 = 11/12, so a(24) = 24*11/12 = 22.
		

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 28, 53.
  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Second Edition, Vol. 1, A K Peters, 2001, pp. 27, 51.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a006022 1 = 0
    a006022 n = (+ 1) $ sum $ takeWhile (> 1) $
              iterate (\x -> x `div` a020639 x) (a032742 n)
    -- Reinhard Zumkeller, Jun 03 2012
    
  • Maple
    P:=proc(n) local FM: FM:=ifactors(n)[2]: seq(seq(FM[j][1], k=1..FM[j][2]), j=1..nops(FM)) end: # A027746
    s:=proc(n) local i,t,b; global P;t:=0; b:=1; for i in [P(n)] do b:=b*i; t:=t+1/b; od; t; end; # A322034/A322035
    A006022 := n -> if n = 1 then 0 else n*s(n); fi;
    # N. J. A. Sloane, Nov 28 2018
  • Mathematica
    Nest[Function[{a, n}, Append[a, Max@ Map[# a[[n/#]] + 1 &, Rest@ Divisors@ n]]] @@ {#, Length@ # + 1} &, {0, 1}, 77] (* Michael De Vlieger, Nov 23 2018 *)
  • PARI
    lista(nn) = {my(v = vector(nn)); for (n=1, nn, if (n>1, my(m = 0); fordiv (n, d, if (d>1, m = max(m, d*v[n/d]+1))); v[n] = m;); print1(v[n], ", "););} \\ Michel Marcus, Nov 25 2018

Formula

a(n) = n * Sum_{k=1..N} (1/(p1^m1*p2^m2*...*pk^mk)) * (pk^mk-1)/(pk-1) for n>=2, where pk is the k-th distinct prime factor of n, N is the number of distinct prime factors of n, and mk is the multiplicity of pk occurring in n. To prove this, expand the factors in Theorem 1 and use the geometrical series identity. - Jonathan Blanchette, Nov 01 2019
From Antti Karttunen, Apr 12 2020: (Start)
a(n) = A322382(n) + A333791(n).
a(n) = A332993(n) - n = A001065(n) - A333783(n). (End)
a(n) = Sum_{k=1..bigomega(n)} F^k(n), where F^k(n) is the k-th iterate of F(n) = A032742(n). - Ridouane Oudra, Jan 26 2024

Extensions

Edited and extended by Christian G. Bower, Oct 18 2002
Entry revised by N. J. A. Sloane, Nov 28 2018

A322035 Let p1 <= p2 <= ... <= pk be the prime factors of n, with repetition; let s = 1/p1 + 1/(p1*p2) + 1/(p1*p2*p3) + ... + 1/(p1*p2*...*pk); a(n) = denominator of s. a(1)=1 by convention.

Original entry on oeis.org

1, 2, 3, 4, 5, 3, 7, 8, 9, 5, 11, 6, 13, 7, 5, 16, 17, 18, 19, 5, 21, 11, 23, 12, 25, 13, 27, 14, 29, 10, 31, 32, 11, 17, 35, 36, 37, 19, 39, 10, 41, 42, 43, 22, 15, 23, 47, 24, 49, 50, 17, 13, 53, 27, 55, 28, 57, 29, 59, 20, 61, 31, 63, 64, 65, 22
Offset: 1

Views

Author

Keywords

Examples

			If n=12 we get the prime factors 2,2,3, and s = 1/2 + 1/4 + 1/12 = 5/6. So a(12) = 6.
The fractions s for n >= 2 are 1/2, 1/3, 3/4, 1/5, 2/3, 1/7, 7/8, 4/9, 3/5, 1/11, 5/6, 1/13, 4/7, 2/5, 15/16, 1/17, 13/18, 1/19, 4/5, 8/21, ...
		

Crossrefs

A017665/A017666 = sum of reciprocals of all divisors of n.

Programs

  • Maple
    # This generates the terms starting at n=2:
    P:=proc(n) local FM: FM:=ifactors(n)[2]: seq(seq(FM[j][1], k=1..FM[j][2]), j=1..nops(FM)) end: # A027746
    f0:=[]; f1:=[]; f2:=[];
    for n from 2 to 120 do
    a:=0; b:=1; t1:=[P(n)];
    for i from 1 to nops(t1) do b:=b/t1[i]; a:=a+b; od;
    f0:=[op(f0),a]; f1:=[op(f1), numer(a)]; f2:=[op(f2),denom(a)]; od:
    f0;    # s
    f1;    # A322034
    f2;    # A322035
    f2-f1; # A322036
  • Mathematica
    f[x_] := Flatten[ConstantArray[#1, #2] & @@@ FactorInteger[x]]; Table[Denominator@ Total@ Table[1/Times @@ #[[;; i]], {i, Length[#]}] &@ f[n], {n, 120}] (* Michael De Vlieger, Jun 20 2025 *)

A322382 a(n) = p*a(n/p) + 1, where p is the smallest prime divisor of n; a(1)=0.

Original entry on oeis.org

0, 1, 1, 3, 1, 3, 1, 7, 4, 3, 1, 7, 1, 3, 4, 15, 1, 9, 1, 7, 4, 3, 1, 15, 6, 3, 13, 7, 1, 9, 1, 31, 4, 3, 6, 19, 1, 3, 4, 15, 1, 9, 1, 7, 13, 3, 1, 31, 8, 13, 4, 7, 1, 27, 6, 15, 4, 3, 1, 19, 1, 3, 13, 63, 6, 9, 1, 7, 4, 13, 1, 39, 1, 3, 19, 7, 8, 9, 1, 31, 40, 3, 1, 19, 6
Offset: 1

Views

Author

David James Sycamore, Dec 05 2018

Keywords

Comments

An equivalent definition of this sequence is: a(1) = 0; and for n > 1, a(n) = n*w(n), where if p1, ..., pk are the prime divisors of n (with repetition) and p1 <= p2 <= ... <= pk, then w(n) = 1/pk + 1/(pk-1*pk) + ... + 1/(p2*p3*...*pk) + ... + 1/(p1*p2*...*pk). Since 2 is smallest prime w(n) <= 1/2 + 1/(2^2) + ... + 1/(2^k), a partial sum of a series which -->1 as n-->oo. Therefore w(n) < 1 and n-a(n) is a sequence of positive numbers (1,1,2,1,4,3,6,...). For n=p^k, p a prime and n >= 1, a(n) = a(p^k) = p^(n-1) + p^(n-2) + ... + p^2 + p + 1 = (p^k-1)/(p-1); e.g., a(2^k) = 2^k - 1.

Examples

			For any prime p, a(p) = p*a(p/p)+1 = p*a(1)+1 = 1, because a(1) = 0.
For n = 6, the least prime divisor is 2, so a(6) = 2*a(6/2)+1 = 2*a(3)+1 = 3.
Using the equivalent definition we get w(6) = 1/3 + 1/6 = 1/2, so a(6) = 6*w(6) = 6*1/2 = 3. For n=32, a(32) = a(2^5) = 2^5 - 1 = 32 - 1 = 31.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := #*a[n/#] + 1 &[FactorInteger[n][[1, 1]] ]; a[1] = 0; Array[a, 1000] (* Michael De Vlieger, Jun 20 2025 *)
  • PARI
    a(n) = if (n==1, 0, my(p = vecmin(factor(n)[,1])); p*a(n/p)+1); \\ Michel Marcus, Jan 25 2019

Formula

From Antti Karttunen, Feb 28 2019 , Mar 04 2019: (Start)
a(1) = 0; for n > 1, a(n) = 1 + A020639(n)*a(A032742(n)).
If n is of the form p^k, k >= 1, then a(n) = A000203(A003557(n)). [Based on author's comments above] (End)
a(n) = Sum_{k=1..bigomega(n)} F^k(n), where F^k(n) is the k-th iterate of F(n) = A052126(n). - Ridouane Oudra, Aug 17 2024

Extensions

More terms from Michel Marcus, Jan 25 2019
Showing 1-4 of 4 results.