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: Moosa Nasir

Moosa Nasir's wiki page.

Moosa Nasir has authored 5 sequences.

A359251 Sum of terms in an odd-even expansion of n.

Original entry on oeis.org

2, 3, 10, 11, 14, 15, 32, 33, 36, 37, 60, 61, 64, 65, 110, 111, 114, 115, 124, 125, 128, 129, 176, 177, 180, 181, 234, 235, 238, 239, 342, 343, 346, 347, 356, 357, 360, 361, 380, 381, 384, 385, 470, 471, 474, 475, 578, 579, 582, 583, 592, 593, 596, 597, 622, 623, 626, 627, 792, 793, 796, 797
Offset: 2

Author

Moosa Nasir, Dec 22 2022

Keywords

Comments

n stands alone in the first row, and then each row expands to a new row as follows.
An even number 2b >= 2 or an odd number 2c+1 >= 3 expands into cells below, below left, and below right, as follows:
even odd
2b 2c+1
b 0 b c 1 c
When expansions overlap, the values add together in the new cells.
Any 0 or 1 does not expand and expansions end when a row of only 0's and 1's is reached.
This last row is 1,1,1 when n=3 and otherwise always 1,0,1.
a(n) is the sum of all cells in all rows, excluding the starting n itself.

Examples

			For n = 4:
      4       initial row
    2 0 2
  1 0 2 0 1
    1 0 1     last row
  a(4) = (2+2) + (1+2+1) + (1+1).
For n = 8:
        8
      4 0 4
    2 0 4 0 2
  1 0 3 0 3 0 1
    1 1 2 1 1
      1 0 1
  a(8) = (4+4) + (2+4+2) + (1+3+3+1) + (1+1+2+1+1) + (1+1) = 32.
		

A359087 a(n) is equal to the last point of a reverse pyramid summation with base 1, 2, 3, ..., n-2, n-1, n, n-1, n-2, ..., 3, 2, 1.

Original entry on oeis.org

1, 4, 19, 78, 301, 1108, 3951, 13758, 47049, 158616, 528619, 1745098, 5715429, 18593032, 60136183, 193525002, 620046513, 1978886448, 6293809971, 19955385762, 63094947981, 198990438408, 626141673375, 1966085927898, 6161660863929, 19276374528468, 60206635741131
Offset: 1

Author

Moosa Nasir, Dec 15 2022

Keywords

Comments

Each element in the pyramid below the base is equal to the sum of the top left, top, and top right elements.
Each row has 2*n-(1+2*r) elements where r is the row number starting from 0.
The sum of elements in the first row is n^2.
The total number of elements in the pyramid is n^2.

Examples

			For n = 3:
  1  2  3  2  1
     6  7  6
       19
so a(3) = 19.
For n = 4:
  1   2   3   4   3   2   1
      6   9  10   9   6
         25  28  25
             78
so a(4) = 78.
		

Crossrefs

Programs

  • C
    unsigned long tri(int n, int k)
    {
        if (n == 0 && k == 0) return 1;
        if(k < -n || k > n) return 0;
        return tri(n - 1, k - 1) + tri(n - 1, k) + tri(n - 1, k + 1);
    }
    unsigned long a(int n)
    {
        unsigned long sum = 0;
        sum += tri(n - 1,0) * n;
        for (int i = 1; i < n; i++)
        {
            sum += 2 * tri(n - 1,n - i) * i;
        }
        return sum;
    }
  • Maple
    f:= proc(n) local L,i;
      L:= [seq(i,i=1..n),seq(n-i,i=1..n-1)];
      for i from 1 to n-1 do
        L:= L[1..-3] + L[2..-2] + L[3..-1]
      od;
      op(L)
    end proc:
    map(f, [$1..30]); # Robert Israel, Dec 17 2022
  • Mathematica
    f[n_] := Module[{L, i}, L = Range[n]~Join~Table[n-i, {i, 1, n-1}]; For[i = 1, i <= n-1, i++, L = L[[1;;-3]] + L[[2;;-2]] + L[[3;;-1]]]; L[[1]]];
    f /@ Range[30] (* Jean-François Alcover, Jan 25 2023, after Robert Israel *)

Formula

a(n) = Sum_{k=1..2*n-1} A004737(k + (n-1)^2) * A027907(k + (n-1)^2 - 1).
Empirical g.f.: x/(1-3*x)^2 - 2*x^2/((1+x)^(1/2)*(1-3*x)^(3/2)). - Robert Israel, Dec 17 2022
a(n) = n*3^(n-1) - 2*A132894(n-1) (conjectured). - Bernard Schott, Dec 20 2022

A358647 Final digit reached by traveling right (with wraparound) through the digits of n. Each move steps right k places, where k is the digit at the beginning of the move. Moves begin at the most significant digit and d moves are made, where d is the number of digits in n.

Original entry on oeis.org

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

Author

Moosa Nasir, Nov 24 2022

Keywords

Examples

			For n = 11323, start at the most significant digit, which is 1.
On move 1, travel 1 unit right, reaching the second digit 1.
On move 2, travel 1 unit right, reaching the middle digit 3.
On move 3, travel 3 units right (wrapping around), reaching the most significant 1 digit again.
On move 4, travel 1 unit right, reaching the second digit 1 (again).
On move 5, travel 1 unit right, reaching the middle digit 3 (again).
Thus, a(11323) = 3.
		

Crossrefs

Cf. A357531 (stepping in 1..n).

Programs

  • Python
    def A358647(n):
        s = list(map(int,str(n)))
        l, i = len(s), 0
        for _ in range(l):
             i = (i+s[i])%l
        return s[i] # Chai Wah Wu, Nov 30 2022

A357531 Final value obtained by traveling clockwise around a circular array with positions numbered clockwise from 1 to n. Each move consists of traveling clockwise k places, where k is the position at the beginning of the move. The first move begins at position 1. a(n) is the position at the end of the n-th move.

Original entry on oeis.org

1, 2, 2, 4, 2, 4, 2, 8, 8, 4, 2, 4, 2, 4, 8, 16, 2, 10, 2, 16, 8, 4, 2, 16, 7, 4, 26, 16, 2, 4, 2, 32, 8, 4, 18, 28, 2, 4, 8, 16, 2, 22, 2, 16, 17, 4, 2, 16, 30, 24, 8, 16, 2, 28, 43, 32, 8, 4, 2, 16, 2, 4, 8, 64, 32, 64, 2, 16, 8, 44, 2, 64, 2, 4, 68, 16, 18, 64, 2, 16, 80, 4, 2, 64, 32, 4, 8, 80
Offset: 1

Author

Moosa Nasir, Nov 19 2022

Keywords

Comments

This is only an empirical observation, but when we graph this sequence, a point always exists at the intersection of y = 2^b and y = -x + 2^(b+1), where b is any integer greater than or equal to 1. This means that a(2^b) = 2^b. This is shown in a link.
Many of the terms seem to be of the form 2^b.

Examples

			For n = 5, with a circular array of positions numbered clockwise from 1 to 5, start at position 1.
On move 1, travel 1 unit clockwise, reaching position 2.
On move 2, travel 2 units clockwise, reaching position 4.
On move 3, travel 4 units clockwise (almost a full circle), reaching position 3.
On move 4, travel 3 units clockwise, reaching position 1.
On move 5, travel 1 unit clockwise, reaching position 2.
Since the final position at the end of the 5th move is 2, a(5) = 2. (See the illustration in the links.)
		

Crossrefs

Cf. A358647 (stepping in digits of n).
Equals {A082495} + 1. - Hugo Pfoertner, Nov 30 2022

Programs

  • C
    int a(int n)
    {
        int current = 1;
        for (int j = 0; j < n; j++) {
            current += current;
            if (current > n) {
                current = current - n;
            }
        }
        return current;
    }
    
  • PARI
    a(n) = lift(Mod(2,n)^n - 1) + 1; \\ Kevin Ryde, Nov 20 2022
    
  • Python
    def A357531(n): return m if (m:=pow(2,n,n)) else n # Chai Wah Wu, Dec 01 2022

Formula

a(n) = ((2^n - 1) mod n) + 1 = A082495(n) + 1. - Jon E. Schoenfield, Nov 20 2022

A354081 Positive integers k such that the first digit of k is divisible by the product of all the remaining digits of k.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 21, 22, 31, 33, 41, 42, 44, 51, 55, 61, 62, 63, 66, 71, 77, 81, 82, 84, 88, 91, 93, 99, 111, 211, 212, 221, 311, 313, 331, 411, 412, 414, 421, 422, 441, 511, 515, 551, 611, 612, 613, 616, 621, 623, 631, 632, 661, 711, 717, 771
Offset: 1

Author

Moosa Nasir, Jun 05 2022

Keywords

Examples

			9331 is a term: the first digit is 9, which is divisible by the product of the remaining digits, i.e., 3*3*1 = 9.
8448 is not a term: the first digit is 8, which is not divisible by the product of the remaining digits, i.e., 4*4*8 = 128.
		

Crossrefs

Subsequence of A052382.

Programs

  • Mathematica
    Select[Range[1000], !MemberQ[d = IntegerDigits[#], 0] && Divisible[First[d], Times @@ Rest[d]] &] (* Amiram Eldar, Jun 09 2022 *)
  • PARI
    isok(k) = my(d=digits(k), p=vecprod(d)); p && ((d[1] % (p/d[1])) == 0); \\ Michel Marcus, Jun 06 2022
    
  • Python
    from math import prod
    def ok(n):
        d = list(map(int, str(n)))
        return 0 not in d and int(d[0])%prod(d[1:]) == 0
    print([k for k in range(800) if ok(k)]) # Michael S. Branicky, Jun 09 2022