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 41-42 of 42 results.

A319674 a(n) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 - 10 - 11 - 12 + ... - (up to n).

Original entry on oeis.org

1, 3, 6, 2, -3, -9, -2, 6, 15, 5, -6, -18, -5, 9, 24, 8, -9, -27, -8, 12, 33, 11, -12, -36, -11, 15, 42, 14, -15, -45, -14, 18, 51, 17, -18, -54, -17, 21, 60, 20, -21, -63, -20, 24, 69, 23, -24, -72, -23, 27, 78, 26, -27, -81, -26, 30, 87, 29, -30, -90, -29
Offset: 1

Views

Author

Wesley Ivan Hurt, Sep 25 2018

Keywords

Comments

In general, for sequences that add the first k natural numbers and then subtract the next k natural numbers, and continue to alternate in this way up to n, we have a(n) = Sum_{i=1..n} i*(-1)^floor((i-1)/k). Here, k=3.

Examples

			a(1) = 1;
a(2) = 1 + 2 = 3;
a(3) = 1 + 2 + 3 = 6;
a(4) = 1 + 2 + 3 - 4 = 2;
a(5) = 1 + 2 + 3 - 4 - 5 = -3;
a(6) = 1 + 2 + 3 - 4 - 5 - 6 = -9;
a(7) = 1 + 2 + 3 - 4 - 5 - 6 + 7 = -2;
a(8) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 = 6;
a(9) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 = 15;
a(10) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 - 10 = 5; etc.
		

Crossrefs

Cf. A001057 (k=1), A077140 (k=2), this sequence (k=3).

Programs

  • Mathematica
    Table[Sum[i (-1)^Floor[(i - 1)/3], {i, n}], {n, 60}]
    Accumulate[Flatten[If[EvenQ[#[[1]]],-#,#]&/@Partition[Range[70],3]]] (* or *) LinearRecurrence[{1,0,-2,2,0,-1,1},{1,3,6,2,-3,-9,-2},70] (* Harvey P. Dale, Sep 15 2021 *)
  • PARI
    Vec(x*(1 + 2*x + 3*x^2 - 2*x^3 - x^4) / ((1 - x)*(1 + x)^2*(1 - x + x^2)^2) + O(x^60)) \\ Colin Barker, Sep 26 2018

Formula

a(n) = Sum_{i=1..n} i*(-1)^floor((i-1)/3).
From Colin Barker, Sep 26 2018: (Start)
G.f.: x*(1 + 2*x + 3*x^2 - 2*x^3 - x^4) / ((1 - x)*(1 + x)^2*(1 - x + x^2)^2).
a(n) = a(n-1) - 2*a(n-3) + 2*a(n-4) - a(n-6) + a(n-7) for n>7.
(End)
Conjectures from Bill McEachen, Dec 19 2024: (Start)
For a(n)>0 and n=A047235(m), a(n) = n/2 + 2*Mod(m,2), otherwise a(n) = 3*(n+1)/2.
For a(n)<0 and n=A007310(m), a(n)= 1 + (1-n)/2 + 2*(Mod(m,2)-1), otherwise a(n) = -3*n/2. (End)

A355017 a(n) is the number of bases in 2..n in which the sum of the digits of n is prime.

Original entry on oeis.org

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

Views

Author

Samuel Harkness, Jun 15 2022

Keywords

Comments

The graph of (n,a(n)) shows an interesting structure, somewhat resembling a comet with four tails. Starting at the bottom tail and going upwards:
Observations:
The bottom "tail" contains all n with both 2 and 3 as prime factors, i.e., numbers n in A008588 (1/6 of all n).
The second "tail" contains all n with 2 as a prime factor but not 3, i.e., numbers n in A047235 (1/3 of all n).
The third "tail" contains all n with 3 as a prime factor but 2, i.e., numbers n in A016945 (1/6 of all n).
The top "tail" contains all n with neither 2 nor 3 as a prime factor, i.e., numbers n in A007310 (1/3 of all n).
The bottom of each "tail" contains n with 5 as a prime factor. Moving up within each "tail," the prime factors of each n tend to increase.

Examples

			For n=7, express 7 in all bases from 2 to 7, then add the numbers, counting those which are prime:
  base 2: 1 1 1 --> 1+1+1=3 prime
  base 3: 2 1   --> 2+1=3   prime
  base 4: 1 3   --> 1+3=4   nonprime
  base 5: 1 2   --> 1+2=3   prime
  base 6: 1 1   --> 1+1=2   prime
  base 7: 1     --> 1=1     nonprime
The sum of the digits of the base-b expansion of 7 in 4 different bases b (2, 3, 5, and 6) from base 2 to 7 is prime, so a(7)=4.
		

Crossrefs

Programs

Previous Showing 41-42 of 42 results.