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.

Previous Showing 81-90 of 93 results. Next

A325887 Excess of sum of odd integers up to n and coprime to n over sum of even integers up to n and coprime to n.

Original entry on oeis.org

1, 1, -1, 4, -2, 6, -3, 16, -1, 20, -5, 24, -6, 42, 4, 64, -8, 54, -9, 80, 6, 110, -11, 96, -2, 156, -1, 168, -14, 120, -15, 256, 10, 272, 12, 216, -18, 342, 12, 320, -20, 252, -21, 440, 4, 506, -23, 384, -3, 500, 16, 624, -26, 486, 20, 672, 18, 812, -29, 480, -30, 930, 6, 1024, 24
Offset: 1

Views

Author

Ilya Gutkovskiy, Sep 07 2019

Keywords

Crossrefs

Cf. A000010, A002129, A023896, A038566, A098903, A007947 (positions of negative terms).

Programs

  • Mathematica
    a[n_] := Sum[Boole[GCD[k, n] == 1] (-1)^(k + 1) k, {k, 1, n}]; Table[a[n], {n, 1, 65}]
    oiei[n_]:=Module[{cp=Select[Range[n-1],CoprimeQ[#,n]&]},Total[Select[ cp,OddQ]]-Total[ Select[cp,EvenQ]]]; Join[{1},Array[oiei,70,2]] (* Harvey P. Dale, Apr 23 2022 *)
  • PARI
    a(n)={sum(k=1, n, -if(gcd(k,n)==1, (-1)^k*k))} \\ Andrew Howroyd, Sep 07 2019

Formula

a(n) = Sum_{k=1..n, gcd(k,n)=1} (-1)^(k+1)*k.
If n even, a(n) = n*phi(n)/2.
a(p^k) = floor(p/2) - p + 1, where p is odd prime.
If n is odd and n > 1, a(n) = mu(rad(n)) * phi(rad(n))/2 where rad(n) is the radical of n and mu is the Mobius function. - Tung T. Nguyen, Nov 10 2022

A333857 Positive odd numbers b with an unequal number of odd and even elements of the restricted residue system of the mod* congruence of Brändli and Beyne (numbers b ordered increasingly).

Original entry on oeis.org

1, 21, 33, 57, 63, 69, 77, 93, 99, 129, 133, 141, 147, 161, 171, 177, 189, 201, 207, 209, 213, 217, 231, 237, 249, 253, 279, 297, 301, 309, 321, 329, 341, 363, 381, 387, 393, 399, 413, 417, 423, 437, 441, 453, 469, 473, 483, 489, 497, 501, 513, 517, 531, 537, 539, 553, 567, 573, 581, 589, 597
Offset: 1

Views

Author

Wolfdieter Lang, Jun 26 2020

Keywords

Comments

For the modified congruence modulo n of Brändli and Beyne, called mod* n, see the link. See also the comments in A333856 for this reduced residue system mod* n, called RRS*(n), for n >= 1.
The odd members of RRS*(n) are denoted by RRS*odd(n), similarly, RRS*even(n) are the even elements of RRS*(n). E.g., RRS*odd(5) = {1} and RRS*even(5) = {2}. Therefore the odd number 5 can be called balanced in the reduced mod* system, because #RRS*odd(5) = 1 = #RRS*even(5).
All even numbers are unbalanced because RRS*(2*m) has only odd members, for m >= 1.
b = 1, with RRS*(1) = {0} is unbalanced, and for odd numbers b >= 3 to be balanced one needs integer phi(b)/4 because #RRS*(b) = phi(b)/2 (phi = A000010). The odd integers >= 3 with integer phi(b)/4 are given in A327922. The present sequence gives, for n >= 2, a proper subset of A327922 consisting of odd numbers b with an unequal number of odd and even elements (unbalanced odd b). Therefore, the condition phi(b)/4 integer for odd b is necessary but not sufficient for such odd b in the reduced mod* system.

Crossrefs

Cf. A038566 (RRS(n)), A333856 (RRS*(n)).

Programs

  • PARI
    RRS(n) = select(x->gcd(n, x)==1, [1..n]); \\ A038566
    RRSstar(n) = if (n<=2, [n-1], my(r=RRS(n)); Vec(r, #r/2)); \\ A333856
    isok(k) = if ((k%2) && ((k==1) || denominator(eulerphi(k)/4)==1), my(v=RRSstar(k)); #select(x->((x%2) == 1), v) != #select(x->((x%2) == 0), v)); \\ Michel Marcus, Sep 17 2023

Formula

This sequence gives the increasingly ordered positive odd integers b from A327922 such that the reduced residue system RRS*(b) does not have the same number of odd and even elements, for n >= 1, The odd number b is then called unbalanced.

Extensions

More terms from Michel Marcus, Sep 17 2023

A341063 a(n) = Sum_{i+j<=m+1} t_i * t_j, where t_1 < ... < t_m are the totatives of n.

Original entry on oeis.org

1, 1, 5, 7, 35, 11, 126, 70, 177, 90, 715, 142, 1365, 357, 680, 876, 3876, 645, 5985, 1300, 2856, 2255, 12650, 1916, 11675, 4446, 11061, 5362, 31465, 3260, 40920, 12376, 18920, 13192, 30240, 9066, 82251, 20691, 37752, 19080, 123410, 13062, 148995, 34870, 52080, 44781, 211876, 27640, 186102, 45650
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Feb 04 2021

Keywords

Comments

The totatives of n are the numbers k <= n with gcd(k,n) = 1.
If p is prime, a(p) = (p+2)*(p+1)*p*(p-1)/24.
It appears that 12*a(n) is always a multiple of n.
Conjecture: if p and q are distinct primes, a(p*q) = (p^2-p)*(q^2-q)*(p^2*q^2-p^2*q-p*q^2+p*q+2*p+2*q)/24.

Examples

			The totatives of 8 are 1, 3, 5, 7, so a(8) = 1*(1+3+5+7)+3*(1+3+5)+5*(1+3)+7*1 = 70.
		

Crossrefs

Cf. A038566.

Programs

  • Maple
    f:= proc(n) local C,i,S,t;
      C:= select(t -> igcd(t,n)=1, [$1..n]);
      S:= ListTools:-PartialSums(C);
      add(S[-i]*C[i], i=1..nops(C))
    end proc:
    map(f, [$1..100]);

A352812 Lexicographically earliest sequence of distinct nonnegative integers such that for any n and k coprime the binary expansions of a(n) and a(k) have no common 1's.

Original entry on oeis.org

0, 1, 2, 4, 8, 3, 16, 5, 32, 9, 64, 6, 128, 17, 10, 256, 512, 7, 1024, 12, 18, 65, 2048, 33, 4096, 129, 34, 20, 8192, 11, 16384, 257, 66, 260, 24, 35, 32768, 261, 130, 13, 65536, 19, 131072, 68, 40, 2049, 262144, 36, 524288, 264, 514, 132, 1048576, 37, 72, 21
Offset: 1

Views

Author

Rémy Sigrist, Apr 04 2022

Keywords

Comments

The n-th row of A038566 gives the k's to consider when computing a(n).

Examples

			The first terms, alongside their binary expansion, the corresponding k's and the implied forbidden bits, are:
  n   a(n)  bin(a(n))  k's                              bin(forbidden)
  --  ----  ---------  -------------------------------  --------------
   1     0          0  {1}                                           0
   2     1          1  {1}                                           0
   3     2         10  {1, 2}                                        1
   4     4        100  {1, 3}                                       10
   5     8       1000  {1, 2, 3, 4}                                111
   6     3         11  {1, 5}                                     1000
   7    16      10000  {1, 2, 3, 4, 5, 6}                         1111
   8     5        101  {1, 3, 5, 7}                              11010
   9    32     100000  {1, 2, 4, 5, 7, 8}                        11101
  10     9       1001  {1, 3, 7, 9}                             110010
  11    64    1000000  {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}          111111
  12     6        110  {1, 5, 7, 11}                           1011000
		

Crossrefs

Programs

  • PARI
    See Links section.

A354846 a(n) is the first composite k such that exactly n primes are the sum of all but one of the numbers from 1 to k-1 that are coprime to k, or -1 if there is no such k.

Original entry on oeis.org

4, 8, 15, 10, 18, 22, 34, 42, 39, 64, 60, 66, 74, 82, 75, 115, 102, 136, 106, 156, 162, 160, 203, 190, 186, 210, 213, 268, 226, 246, 240, 291, 304, 300, 306, 312, 364, 330, 344, 342, 362, 368, 386, 412, 448, 420, 466, 450, 472, 474, 496, 518, 495, 539, 483, 510, 594, 660, 564, 609, 655, 708, 636
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jun 08 2022

Keywords

Comments

Conjecture: for every composite k there is at least one such prime.

Examples

			a(3) = 15 because 15 is composite, the numbers from 1 to 14 coprime to 15 are 1, 2, 4, 7, 8, 11, 13, 14, and the 3 primes 47 = 1+2+4+7+8+11+14, 53 = 1+2+4+8+11+13+14 and 59 = 2+4+7+8+11+13+14 are sums of all but one of these.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local C,s;
          C:= select(t -> igcd(t,n)=1, [$1..n-1]);
          s:= convert(C,`+`);
          nops(select(isprime,map(t -> s-t, C)))
    end proc:
    N:= 100; # for a(1)..a(N)
    V:= Vector(N): count:= 0:
    for nn from 4 while count < N do
        if isprime(nn) then next fi;
        v:= f(nn);
      if v > N then next fi;
      if V[v] = 0 then count:= count+1; V[v]:= nn fi
    od:
    convert(V,list);

A381803 Number of residues r in {0..n-1} that are not coprime to n and not in row n of A381801.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 3, 0, 4, 0, 1, 0, 4, 1, 0, 0, 6, 3, 0, 6, 8, 0, 4, 0, 11, 5, 8, 0, 9, 0, 0, 10, 13, 0, 7, 0, 9, 7, 11, 0, 17, 5, 3, 0, 12, 0, 6, 8, 21, 1, 0, 0, 17, 0, 25, 15, 26, 8, 15, 0, 24, 11, 12, 0, 29, 0, 0, 7, 17, 3, 22, 0, 32, 23
Offset: 1

Views

Author

Michael De Vlieger, Mar 24 2025

Keywords

Comments

The intersection of row n of A038566 and row n of A381801 is {1} for n > 1. Therefore most of the terms in row n of A381801 are in row n of A121998 (reading n itself in row n of A121998 instead as n mod n = 0). Thus, a(n) is the number of terms n that are in row n of A121998 but not in A381801.

Examples

			Let R(n) = row n of A381801 and let S(n) = row n of A121998, where n in S(n) is instead taken mod n.
a(2) = 0 since S(2) = {} and R(2) = {0, 1}; R(2) \ S(2) is empty.
a(4) = 0 since S(4) = {0, 2} and R(4) = {0, 1, 2}; R(4) \ S(4) is empty.
a(6) = 0 since S(6) = {0, 2, 3, 4} and R(6) = {0, 1, 2, 3, 4} is empty.
a(8) = 1 since S(8) = {0, 2, 4, 6} and R(8) = {0, 1, 2, 4} = {6}.
a(9) = 1 since S(9) = {0, 3, 6} and R(6) = {0, 1, 3} = {6}.
a(10) = 0 since S(10) = {0, 2, 4, 5, 6, 8} and R(10) = {0, 1, 2, 4, 5, 6, 8} is empty.
  Therefore in base 10, numbers k such that rad(k) | 10 (i.e., k in A003592) may end in any number that is not coprime to 10. (Except 1 ends in the digit one, which is coprime to 10).
a(12) = 1 since S(12) = {0, 2, 3, 4, 6, 8, 9, 10} and R(12) = {0, 1, 2, 3, 4, 6, 8, 9} = {10}.
  Therefore in base 12, numbers k such that rad(k) | 12 (i.e., k in A003586) never end in digit 10.
a(14) = 3 since S(14) = {0, 2, 4, 6, 7, 8, 10, 12} and R(14) = {0, 1, 2, 4, 7, 8} = {6, 10, 12}.
  Therefore in base 14, numbers k such that rad(k) | 14 (i.e., k in A003591) never end in digits 6, 10, or 12.
a(16) = 4 since S(16) = {0, 2, 4, 6, 8, 10, 12, 14} and R(14) = {0, 1, 2, 4, 8} = {6, 10, 12, 14}, etc.
  Therefore in hexadecimal, numbers k such that powers of 2 (i.e., A000079) never end in digits 6, 10, 12, or 14.
		

Crossrefs

Programs

  • Mathematica
    f[x_] := Block[{c, ff, m, r, p, s, w},
      c[_] := True; ff = FactorInteger[x][[All, 1]]; w = Length[ff];
      s = {1};
      Do[Set[p[i], ff[[i]]], {i, w}];
      Do[Set[s, Union@ Flatten@ Join[s, #[[-1, 1]]]] &@ Reap@
        Do[m = s[[j]];
          While[Sow@ Set[r, Mod[m*p[i], x]];
            c[r],
            c[r] = False;
            m *= p[i]],
           {j, Length[s]}],
        {i, w}]; s ];
    {0}~Join~Table[1 + n - EulerPhi[n] - Length@ f[n], {n, 2, 120}]

Formula

a(n) = 1 + n - phi(n) - A381800(n)
= 1 + n - A000010(n) - A381800(n)
= 1 + A051953(n) - A381800(n)
= A381802(n) - phi(n) - 1.
a(p) = 0.
a(p^m) = p^(m-1) - m.

A384244 Triangle in which the n-th row gives the numbers k from 1 to n such that the greatest common unitary divisor of k and n is 1.

Original entry on oeis.org

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

Views

Author

Amiram Eldar, May 23 2025

Keywords

Examples

			Triangle begins:
  1
  1
  1, 2
  1, 2, 3
  1, 2, 3, 4
  1, 4, 5
  1, 2, 3, 4, 5, 6
  1, 2, 3, 4, 5, 6, 7
  1, 2, 3, 4, 5, 6, 7, 8
  1, 3, 4, 7, 8, 9
		

Crossrefs

The bi-unitary analog of A038566.
Cf. A116550 (row lengths), A200723 (row sums), A077610, A089912, A165430, A225174, A064379 (infinitary analog), A384046 (unitary analog).

Programs

  • Mathematica
    udiv[n_] := Select[Divisors[n], CoprimeQ[#, n/#] &];
    ugcd[n_, m_] := Max[Intersection[udiv[n], udiv[m]]];
    row[n_] := Select[Range[n], ugcd[n, #] == 1 &]; Array[row, 15] // Flatten
  • PARI
    udiv(n) = select(x -> gcd(x, n/x) == 1, divisors(n));
    ugcd(n, m) = vecmax(setintersect(udiv(n), udiv(m)));
    row(n) = select(x -> ugcd(n, x) == 1, vector(n, i, i));

A132068 Irregular array: row n has A000010(n) terms: the sum of the first m terms of row n is the m-th positive integer which is coprime to n.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Oct 30 2007

Keywords

Comments

The first term of each row is 1. The sum of the terms of row n is n-1, for n>=2. After the initial 1, the remaining terms of each row are the same forward or backward.

Examples

			The positive integers which are <= 12 and are coprime to 12 are 1,5,7,11. Row 12 of the array is: 1,4,2,4. So we have: 1=1; 1+4=5; 1+4+2=7; 1+4+2+4=11.
The first 12 rows of the array:
1;
1;
1,1;
1,2;
1,1,1,1;
1,4;
1,1,1,1,1,1;
1,2,2,2;
1,1,2,1,2,1;
1,2,4,2;
1,1,1,1,1,1,1,1,1,1;
1,4,2,4
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{g},g = Select[Range[n], GCD[ #, n] == 1 &]; g - Prepend[Most[g], 0]]; Flatten[Array[f, 25]] (* Ray Chandler, Nov 01 2007 *)

Extensions

Extended by Ray Chandler, Nov 01 2007

A261527 Irregular triangular array giving minimum number of reciprocal steps in the boomerang fractions process needed to return to 1 if a returning path exists, otherwise 0.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1, 1, 2, 1, 1, 1, 1, 2, 20, 1, 1, 1, 4, 1, 1, 1, 2, 2, 1, 2, 24, 2
Offset: 1

Views

Author

William P. Orrick, Aug 21 2015

Keywords

Comments

The boomerang fractions process is defined as follows. Fix a rational number q, 0
Let q(n) be the n-th rational number in the interval (0,1) in the canonical ordering, that is, q(n)=A038566(n+1)/A038567(n+1). Then a(n) is obtained by applying the sequence definition with q=q(n).
The value of a(n) is 1 if and only if q(n) is the difference of two unit fractions.
If q(m) = k q(n) for some positive integer k, then a(n) <= a(m).
The first rational number in the canonical ordering for which it is not known whether a(n) is nonzero is q(40)=9/11. If a(40) is nonzero, then a(40) >= 55.

Examples

			a(1) = 1 since q(1) = 1/2 and there is the returning path 1 --> 1+2*(1/2) = 2 --> 1/2 --> 1/2+1/2 = 1, which uses the reciprocal operation once.
a(8) = 2 since q(8) = 3/5, which cannot be written as the difference of two unit fractions (ruling out a(8) = 1) and because there is the returning path 1 --> 1+15*(3/5) = 10 --> 1/10 --> 1/10+4*(3/5) = 5/2 --> 2/5 --> 2/5+3/5 = 1, which uses the reciprocal operation twice.
Triangle starts:
1;
1, 1;
1, 1;
1, 1, 2, 1;
1, 1;
1, 1, 1, 2, 4, 1;
1, 1, 2, 1;
1, 1, 1, 2, 20, 1;
1, 1, 4, 1;
1, 1, 2, 2, 1, 2, 24, 2,
...
		

Crossrefs

Cf. A256174.

Programs

  • Mathematica
    (* In the following code, Alpha is the operation "add q" and Beta is the operation "take the reciprocal and add q". The set L(j) is defined to be the set of positive rational numbers r such that there is a path from r to 1 that uses Beta exactly j times. The program computes L(1), L(2), and so on, until an L(j) is found that contains 1, in which case it returns j, or until maxIterations is exceeded, in which case it returns 0. The function iterateUntilOne can generate the result for all q up to 6/11 rather quickly, but for q = 7/11, which corresponds to a(38) = 24, it requires considerable time; it is not capable of ruling out the existence of a returning path that uses Beta more than maxIterations times. *)
    applyBetaInverse[q_, x_] := 1/(x - q)
    applyAlphaPowerInverse[q_, x_] :=
    Table[x - q j, {j, 0, Ceiling[x/q] - 1}]
    iterateUntilOne[q_, maxIterations_] :=
    Module[{list, listOld, oneFound, it, betaInverseResult},
      listOld = Flatten[applyAlphaPowerInverse[q, #] & /@ {1}];
      oneFound = False;
      For[it = 1, ! oneFound && it <= maxIterations, it++,
       betaInverseResult =
        applyBetaInverse[q, #] & /@ Select[listOld, # > q &];
       list = Flatten[applyAlphaPowerInverse[q, #] & /@ betaInverseResult];
       oneFound = MemberQ[list, 1];
       Print["L(", it, ") : length ", Length[list],
        If[oneFound, ", contains 1", ", does not contain 1"]];
       listOld = list
       ];
      If[oneFound,
       it - 1,
       0
       ]
      ]
    iterateUntilOne[#, 20] & /@Flatten[Join[
      Table[Select[Range[1, d], CoprimeQ[d, #] &]/d, {d, 2, 10}],
      Range[1, 6]/11]]

A317988 Farey fraction tree, reading each fraction's numerator first, then its denominator.

Original entry on oeis.org

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

Author

Robert G. Wilson v, Oct 03 2018

Keywords

Comments

0 < a(2n-1)/a(2n) < 1 for n > 2.
This appears to be A038568 preceded by 0,1,1. - Peter Kagey, Jan 09 2022

Examples

			Farey fraction tree begins:
  0/1                                             1/1
                          1/2
                  1/3             2/3
              1/4                     3/4
           1/5       2/5       3/5       4/5
          1/6                             5/6
         1/7    2/7    3/7   4/7    5/7    6/7
        1/8         3/8         5/8         7/8
       1/9   2/9       4/9   5/9       7/9   8/9
      1/10      3/10                7/10     9/10
  ...
		

Crossrefs

Programs

  • Mathematica
    Table[ If[ GCD[n, d] == 1, {n, d}, {}], {d, 0, 12}, {n, 0, d}] // Flatten

Formula

0,1 followed by the interleaving of A038566 & A038567.
Previous Showing 81-90 of 93 results. Next