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 11-20 of 22 results. Next

A372523 Triangle read by rows: T(n, k) is equal to n/k if k | n, else to the concatenation of A003988(n, k) = floor(n/k) and A051127(k, n) = n mod k.

Original entry on oeis.org

1, 2, 1, 3, 11, 1, 4, 2, 11, 1, 5, 21, 12, 11, 1, 6, 3, 2, 12, 11, 1, 7, 31, 21, 13, 12, 11, 1, 8, 4, 22, 2, 13, 12, 11, 1, 9, 41, 3, 21, 14, 13, 12, 11, 1, 10, 5, 31, 22, 2, 14, 13, 12, 11, 1, 11, 51, 32, 23, 21, 15, 14, 13, 12, 11, 1, 12, 6, 4, 3, 22, 2, 15, 14, 13, 12, 11, 1
Offset: 1

Views

Author

Stefano Spezia, May 04 2024

Keywords

Examples

			The triangle begins:
  1;
  2,  1;
  3, 11,  1;
  4,  2, 11,  1;
  5, 21, 12, 11,  1;
  6,  3,  2, 12, 11,  1;
  7, 31, 21, 13, 12, 11, 1;
  ...
		

Crossrefs

Cf. A000012 (right diagonal), A000027 (1st column).

Programs

  • Mathematica
    T[n_,k_]:=If[Divisible[n,k],n/k,FromDigits[Join[IntegerDigits[Floor[n/k]],IntegerDigits[Mod[n,k]]]]]; Table[T[n,k],{n,12},{k,n}]//Flatten (* or *)
    T[n_,k_]:=Floor[n/k]10^IntegerLength[Mod[n,k]]+Mod[n,k]; Table[T[n,k],{n,12},{k,n}]//Flatten (* or *)
    T[n_, k_]:=SeriesCoefficient[x^k(1+Sum[(i + 10^(1+Floor[Log10[Mod[n,k]]]))*x^i, {i, k-1}] - Sum[i*x^(k+i), {i, k-1}])/(1-x^k)^2, {x, 0, n}]; Table[T[n, k], {n, 12}, {k, n}]//Flatten

Formula

T(n, k) = floor(n/k)*10^(1+floor(log10(n mod k))) + (n mod k) if n is not divisible by k.
T(n, n) = 1.
T(n, 1) = n.
T(n, k) = 2*T(n-k, k) - T(n-2*k, k) for n >= 3*k.
T(n, k) = [x^n] x^k*(1 + (Sum_{i=1..k-1} (i + 10^(1+floor(log10(n mod k))))*x^i) - (Sum_{i=1..k-1} i*x^(k+i)))/(1 - x^k)^2.

A378275 Numbers m which satisfy the equation: (m - floor((m - k)/k)) mod k = 1 (1 <= k <= m) only for k = 2 and m - 1.

Original entry on oeis.org

3, 4, 7, 11, 19, 23, 59, 83, 167, 227, 491, 659, 839, 983, 1019, 1091, 1319, 1459, 1523, 1847, 2179, 2503, 2963, 3719, 3767, 4519, 4871, 4919, 5059, 6563, 9239, 9419, 10883, 12107, 12539, 14891, 15383, 20071, 20747, 23819, 25219, 26759, 33851, 35591, 37379, 45191
Offset: 1

Views

Author

Lechoslaw Ratajczak, Nov 21 2024

Keywords

Comments

Every term greater than 4 has the form 4*t + 3.
Let b(z) be the number of elements of this sequence <= z:
-------------
z | b(z)
-------------
10^2 | 8
10^3 | 14
10^4 | 32
10^5 | 55
10^6 | 125
10^7 | 347
10^8 | 950
-------------
Every term greater than 4 is prime.

Examples

			Let T(i,j) be the triangle read by rows: T(i,j) = (i - floor((i - j)/j)) mod j for 1 <= j <= i. The triangle begins:
 i\j | 1 2 3 4 5 6 7 8 9 ...
-----+------------------
   1 | 0
   2 | 0 0
   3 | 0 1 0
   4 | 0 1 1 0
   5 | 0 0 2 1 0
   6 | 0 0 2 2 1 0
   7 | 0 1 0 3 2 1 0
   8 | 0 1 1 3 3 2 1 0
   9 | 0 0 1 0 4 3 2 1 0
 ...
The j-th column has period j^2, r-th element of this period has the form (r - 1 - floor((r - 1)/j)) mod j (1 <= r <= j^2). The period of j-th column consists of the sequence (0,1,2,...,j-1) and its consecutive j-1 right rotations (moving rightmost element to the left end).
7 is in this sequence because the only k's satisfying the equation (7 - floor((7 - k)/k)) mod k = 1 are 2 and (7-1).
		

Crossrefs

Programs

  • Maxima
    (f(i, j):=mod((i-floor((i-j)/j)), j),
    (n:3, for t:7 thru 100000 step 4 do
    (for k:3 while f(t, k)#1 and k
    				
  • PARI
    is(m) = if(m%4==3, for(k=3, m\2, if((m-m\k)%k==0, return(0))); 1, m==4); \\ Jinyuan Wang, Jan 14 2025

A049765 Triangular array T, read by rows: T(n,k) = (k mod n) + (n mod k), for k = 1..n and n >= 1.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			Triangle T(n,k) (with rows n >= 1 and columns k >= 1) begins as follows:
  0;
  1, 0;
  1, 3, 0;
  1, 2, 4, 0;
  1, 3, 5, 5, 0;
  1, 2, 3, 6, 6,  0;
  1, 3, 4, 7, 7,  7,  0;
  1, 2, 5, 4, 8,  8,  8,  0;
  1, 3, 3, 5, 9,  9,  9,  9,  0;
  1, 2, 4, 6, 5, 10, 10, 10, 10, 0;
  ...
		

Crossrefs

Row sums are in A049766.

Programs

  • GAP
    Flat(List([1..15], n-> List([1..n], k-> (k mod n) + (n mod k) ))); # G. C. Greubel, Dec 13 2019
  • Magma
    [[(k mod n) + (n mod k): k in [1..n]]: n in [1..15]]; // G. C. Greubel, Dec 13 2019
    
  • Maple
    seq(seq( `mod`(k, n) + `mod`(n, k), k = 1..n), n = 1..15); # G. C. Greubel, Dec 13 2019
  • Mathematica
    Table[Mod[k,n] + Mod[n,k], {n,15}, {k,n}]//Flatten (* G. C. Greubel, Dec 13 2019 *)
  • PARI
    T(n,k) = k%n + n%k;
    for(n=1,15, for(k=1,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Dec 13 2019
    
  • Sage
    [[(k%n) + (n%k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Dec 13 2019
    

A309176 a(n) = n^2 * (n + 1)/2 - Sum_{k=1..n} sigma_2(k).

Original entry on oeis.org

0, 0, 2, 3, 12, 13, 33, 40, 66, 81, 135, 135, 212, 249, 319, 354, 489, 511, 681, 725, 876, 981, 1233, 1235, 1509, 1660, 1920, 2032, 2437, 2472, 2936, 3091, 3488, 3755, 4275, 4290, 4955, 5292, 5854, 6024, 6843, 6968, 7870, 8190, 8839, 9340, 10420, 10442, 11568, 12038, 13014, 13474, 14851, 15098, 16436
Offset: 1

Views

Author

Ilya Gutkovskiy, Jul 15 2019

Keywords

Crossrefs

Programs

  • Mathematica
    Table[n^2 (n + 1)/2 - Sum[DivisorSigma[2, k], {k, 1, n}], {n, 1, 55}]
    nmax = 55; CoefficientList[Series[x (1 + 2 x)/(1 - x)^4 - 1/(1 - x) Sum[k^2 x^k/(1 - x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
    Table[Sum[Mod[n, k] k, {k, 1, n}], {n, 1, 55}]
  • PARI
    a(n) = n^2*(n+1)/2 - sum(k=1, n, sigma(k, 2)); \\ Michel Marcus, Sep 18 2021
    
  • Python
    from math import isqrt
    def A309176(n): return (n**2*(n+1)>>1)+((s:=isqrt(n))**2*(s+1)*(2*s+1)-sum((q:=n//k)*(6*k**2+q*(2*q+3)+1) for k in range(1,s+1)))//6 # Chai Wah Wu, Oct 21 2023

Formula

G.f.: x * (1 + 2*x)/(1 - x)^4 - (1/(1 - x)) * Sum_{k>=1} k^2 * x^k/(1 - x^k).
a(n) = Sum_{k=1..n} (n mod k) * k.
a(n) = A002411(n) - A064602(n).

A324472 a(n) = 1000 mod n.

Original entry on oeis.org

0, 0, 1, 0, 0, 4, 6, 0, 1, 0, 10, 4, 12, 6, 10, 8, 14, 10, 12, 0, 13, 10, 11, 16, 0, 12, 1, 20, 14, 10, 8, 8, 10, 14, 20, 28, 1, 12, 25, 0, 16, 34, 11, 32, 10, 34, 13, 40, 20, 0, 31, 12, 46, 28, 10, 48, 31, 14, 56, 40, 24, 8, 55, 40, 25, 10, 62, 48, 34, 20, 6, 64, 51, 38, 25, 12, 76
Offset: 1

Views

Author

N. J. A. Sloane, Mar 07 2019, following a suggestion from Charles Kusniec

Keywords

Examples

			a(98) = 1000 mod 98 = 20 as 1000 = 98 * 10 + 20. - _David A. Corneth_, Mar 07 2019
		

Crossrefs

Programs

Formula

a(n) = 1000 for n >= 1001.
a(n) = 0 <=> n in { A018767 }.
a(n) = 1 <=> n > 1 and n in { A018766 }.

A369311 Square array A(n, k), n >= 0, k > 0, read by upwards antidiagonals: P(A(n, k)) is the remainder of the polynomial long division of P(n) by P(k) (where P(m) denotes the polynomial over GF(2) whose coefficients are encoded in the binary expansion of the nonnegative integer m).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jan 19 2024

Keywords

Comments

For any number m >= 0 with binary expansion Sum_{k >= 0} b_k * 2^k, P(m) = Sum_{k >= 0} b_k * X^k.

Examples

			Array A(n, k) begins:
  n\k | 1  2  3  4  5  6  7  8  9  10  11  12
  ----+--------------------------------------
    0 | 0  0  0  0  0  0  0  0  0   0   0   0
    1 | 0  1  1  1  1  1  1  1  1   1   1   1
    2 | 0  0  1  2  2  2  2  2  2   2   2   2
    3 | 0  1  0  3  3  3  3  3  3   3   3   3
    4 | 0  0  1  0  1  2  3  4  4   4   4   4
    5 | 0  1  0  1  0  3  2  5  5   5   5   5
    6 | 0  0  0  2  3  0  1  6  6   6   6   6
    7 | 0  1  1  3  2  1  0  7  7   7   7   7
    8 | 0  0  1  0  2  2  1  0  1   2   3   4
    9 | 0  1  0  1  3  3  0  1  0   3   2   5
   10 | 0  0  0  2  0  0  3  2  3   0   1   6
   11 | 0  1  1  3  1  1  2  3  2   1   0   7
   12 | 0  0  0  0  3  0  2  4  5   6   7   0
		

Crossrefs

See A369312 for the corresponding quotients.

Programs

  • PARI
    A(n, k) = { fromdigits(lift(Vec( (Mod(1, 2) * Pol(binary(n))) % (Mod(1, 2) * Pol(binary(k))))), 2) }

A372727 Triangle read by rows: T(n, k) = n if k = 0, otherwise n - k*floor(n/k). The binary modulo operation.

Original entry on oeis.org

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

Views

Author

Peter Luschny, May 13 2024

Keywords

Comments

The binary operation 'mod' as defined here is discussed in 'Concrete Mathematics' by Graham et. al. on p. 82 and the connection with the congruence relation '(mod)' on p. 123. See also Bach & Shallit, p. 21, and Apostol, p. 14.
This definition is implemented in Sage, but not in Python. For example, Sage answers 0.mod(0) = 0, whereas in Python 0 % 0 leads to a 'ZeroDivisionError'. What is often misunderstood is that the operation 'mod' gives answers to divisibility, not to division. Apostol shows that n|0 (every integer divides zero), but 0|n implies n = 0 (zero divides only zero), and thus confirms the result given by Sage.

Examples

			Triangle begins:
  [ 0]  0;
  [ 1]  1, 0;
  [ 2]  2, 0, 0;
  [ 3]  3, 0, 1, 0;
  [ 4]  4, 0, 0, 1, 0;
  [ 5]  5, 0, 1, 2, 1, 0;
  [ 6]  6, 0, 0, 0, 2, 1, 0;
  [ 7]  7, 0, 1, 1, 3, 2, 1, 0;
  [ 8]  8, 0, 0, 2, 0, 3, 2, 1, 0;
  [ 9]  9, 0, 1, 0, 1, 4, 3, 2, 1, 0;
  [10] 10, 0, 0, 1, 2, 0, 4, 3, 2, 1, 0;
  [11] 11, 0, 1, 2, 3, 1, 5, 4, 3, 2, 1, 0;
.
The triangle shows the modulo operation in the range 0 <= k <= n. Test your
computer implementation in the range R X R where R = [-6, ..., 0, ..., 6].
According to Graham et al. it should look like this:
   0, -1, -2,  0,  0, 0, -6, 0, 0, 0, 2, 4, 0
  -5,  0, -1, -2, -1, 0, -5, 0, 1, 1, 3, 0, 1
  -4, -4,  0, -1,  0, 0, -4, 0, 0, 2, 0, 1, 2
  -3, -3, -3,  0, -1, 0, -3, 0, 1, 0, 1, 2, 3
  -2, -2, -2, -2,  0, 0, -2, 0, 0, 1, 2, 3, 4
  -1, -1, -1, -1, -1, 0, -1, 0, 1, 2, 3, 4, 5
   0,  0,  0,  0,  0, 0,  0, 0, 0, 0, 0, 0, 0
  -5, -4, -3, -2, -1, 0,  1, 0, 1, 1, 1, 1, 1
  -4, -3, -2, -1,  0, 0,  2, 0, 0, 2, 2, 2, 2
  -3, -2, -1,  0, -1, 0,  3, 0, 1, 0, 3, 3, 3
  -2, -1,  0, -2,  0, 0,  4, 0, 0, 1, 0, 4, 4
  -1,  0, -3, -1, -1, 0,  5, 0, 1, 2, 1, 0, 5
   0, -4, -2,  0,  0, 0,  6, 0, 0, 0, 2, 1, 0
		

References

  • Tom Apostol, Introduction to analytic number theory, 1976, Springer, page 14.
  • Eric Bach and Jeffrey Shallit, Algorithmic Number Theory, 1997, p. 21.
  • Ronald L. Graham, Donald E. Knuth and Oren Patashnik, Concrete Mathematics, 2nd ed., Addison-Wesley, 1994, 34th printing 2022, p. 81f.

Crossrefs

Cf. A111490 (row sums).
Cf. A048158.

Programs

  • Maple
    MOD := (n, k) -> ifelse(k = 0, n, n - k * iquo(n, k)):
    seq( seq(MOD(n, k), k = 0..n), n = 0..12);
  • Python
    def T(n, k): return n if k == 0 else n - k * (n // k)
    for n in range(12): print([T(n, k) for k in range(n + 1)])
    
  • Python
    def A372727_T(n, k): return n % k if k else n # Chai Wah Wu, May 14 2024
  • SageMath
    def T(n, k): return n.mod(k)
    for n in srange(12): print([T(n, k) for k in range(n + 1)])
    

A380153 Numbers m for which the sum of all values of k satisfying the equation: (m - floor((m - k)/k)) mod k = 0 (1 <= k <= m) equals 2*m.

Original entry on oeis.org

39, 4395, 29055, 57931, 81115, 152571, 164955, 410731, 664747, 877435, 2080875, 2521087, 2539515
Offset: 1

Views

Author

Lechoslaw Ratajczak, Jan 13 2025

Keywords

Comments

a(14) > 3*10^6 (if it exists). Is there any even term?

Examples

			Let T(i,j) be the triangle read by rows: T(i,j) = (i - floor((i - j)/j)) mod j for 1 <= j <= i. The triangle begins:
 i\j | 1 2 3 4 5 6 7 8 9 10 11 ...
-----+------------------------
   1 | 0
   2 | 0 0
   3 | 0 1 0
   4 | 0 1 1 0
   5 | 0 0 2 1 0
   6 | 0 0 2 2 1 0
   7 | 0 1 0 3 2 1 0
   8 | 0 1 1 3 3 2 1 0
   9 | 0 0 1 0 4 3 2 1 0
  10 | 0 0 2 1 4 4 3 2 1  0
  11 | 0 1 0 2 0 5 4 3 2  1  0
  ...
The j-th column has period j^2, r-th element of this period has the form (r - 1 - floor((r - 1)/j)) mod j (1 <= r <= j^2). The period of j-th column consists of the sequence (0,1,2,...,j-1) and its consecutive j-1 right rotations (moving rightmost element to the left end).
39 is in this sequence because the only k's <= 39 satisfying the equation (39 - floor((39 - k)/k)) mod k = 0 are: 1, 3, 7, 9, 19, 39, hence: 1+3+7+9+19+39 = 78 = 2*39.
		

Crossrefs

Programs

  • Maxima
    (f(i, j):=mod(i-floor((i-j)/j), j),
    (n:0, for m:2 thru 5000 do
    (s:0, for k:1 thru floor(m/2) do
    (if f(m, k)=0 then
    (s:s+k)), if s=m then
    (n:n+1, print(n , "" , m)))));

Extensions

a(9)-a(13) from Jinyuan Wang, Jan 14 2025

A283190 a(n) is the number of different values n mod k for 1 <= k <= floor(n/2).

Original entry on oeis.org

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

Views

Author

Thomas Kerscher, Mar 02 2017

Keywords

Comments

a(n) is the number of distinct terms in the first half of the n-th row of the A048158 triangle. - Michel Marcus, Mar 04 2017
a(n)/n appears to converge to a constant, approximately 0.2296. Can this be proved, and does the constant have a closed form? - Robert Israel, Mar 13 2017
The constant that a(n)/n approaches is Sum {p prime} 1/(p^2+p)* Product {q prime < p} (q-1)/q. - Michael R Peake, Mar 16 2017

Examples

			a(7) = 2 because 7=0 (mod 1), 7=1 (mod 2), 7=1 (mod 3), two different results.
		

Crossrefs

Cf. A048158.

Programs

  • Maple
    N:= 100: # to get a(1)..a(N)
    V:= Vector(N,1):
    V[1]:= 0:
    for m from 2 to N-1 do
      k:= m/min(numtheory:-factorset(m));
      ns:= [seq(n,n=m+1..min(N,m+k-1))];
      V[ns]:= map(`+`,V[ns],1);
    od:
    convert(V,list); # Robert Israel, Mar 13 2017
  • Mathematica
    Table[Length@ Union@ Map[Mod[n, #] &, Range@ Floor[n/2]], {n, 78}] (* Michael De Vlieger, Mar 03 2017 *)
  • PARI
    a(n) = #vecsort(vector(n\2, k, n % k),,8); \\ Michel Marcus, Mar 02 2017

A324471 a(n) = 10 mod n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Mar 07 2019, following a suggestion from Charles Kusniec

Keywords

Crossrefs

Programs

  • Mathematica
    Mod[10,Range[100]] (* Paolo Xausa, Nov 14 2023 *)

Formula

From Elmo R. Oliveira, Aug 03 2024: (Start)
G.f.: x^3*(1 + x - 2*x^2 + 4*x^3 - x^4 - x^5 - x^6 - x^7 + 10*x^8)/(1 - x).
a(n) = 10 for n > 10. (End)
Previous Showing 11-20 of 22 results. Next