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 21-30 of 35 results. Next

A322523 a(n) is the least nonnegative integer k for which there does not exist i < j with i+j=n and a(i)=a(j)=k.

Original entry on oeis.org

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

Views

Author

Aidan Clarke, Aug 28 2019

Keywords

Comments

If x is an integer that we are checking whether it is an option for a(n), at position n = 3(3^(x+1)-1)/2 there appears to begin a repeating sequence (containing 3^(x+1) terms) of whether it can or cannot be used for a(n) that continues infinitely.
The variant where we drop the condition "i < j" corresponds to A007814. - Rémy Sigrist, Sep 06 2019

Examples

			a(1) = 0.
a(2) = 0.
a(3) = 1 (because a(1) and a(2) both equal 0).
a(5) = 1 (because a(1) and a(4) both equal 0).
a(8) = 2 (because a(1) and a(7) equal 0, and a(3) and a(5) equal 1).
		

Crossrefs

Programs

  • Maple
    for n from 1 to 100 do
      forbid:= {seq(A[i],i= select(i -> A[i]=A[n-i],[$1..(n-1)/2]))};
      if forbid = {} then A[n]:= 0 else A[n]:= min({$0..max(forbid)+1} minus forbid) fi;
    od:
    seq(A[i],i=1..100); # Robert Israel, Sep 06 2019
  • PARI
    least(v, n) = {my(found = []); for (i=1, n, if (i >= n-i, break, if (v[i] == v[n-i], found = Set(concat(found, v[i]))));); if (#found == 0, return(0)); my(m = vecmax(found)); for (i=0, m, if (!vecsearch(found, i), return (i))); return (m+1);}
    lista(nn) = {my(v = vector(nn)); for (n=1, nn, v[n] = least(v, n);); v;} \\ Michel Marcus, Sep 07 2019
    
  • PARI
    a(n) = my(v=valuation(n,3)); n=n/3^v; if(n==2 || n%3==1, v, A215879((n-5)/3)+1+v) \\ Jianing Song, Aug 23 2022; see A215879 for its program
    
  • Python
    def A322523(n):
        c, m = 0, n
        while not (a:=divmod(m,3))[1]:
            c += 1
            m = a[0]
        if m==2 or m%3==1: return c
        m = (m+1)//3-2
        while (a:=divmod(m,3))[1]:
            c += 1
            m = a[0]
        return c+1 # Chai Wah Wu, Oct 15 2022

Formula

a(n) = 0 iff n belongs to A033627. - Rémy Sigrist, Sep 06 2019
From Jianing Song, Aug 23 2022: (Start)
Properties of this sequence:
(1) a(n) = a(n/3) + 1 for n == 0 (mod 3).
Proof is based on induction on n. Obviously a(n) != 0. For 1 <= e <= a(n/3), there exists i+j = n/3, i < j such that a(i) = a(j) = e-1, by induction hypothesis we have a(3*i) = a(3*j) = e, so a(n) != e. a(n) = a(n/3) + 1 is OK. Suppose otherwise that n = i+j, i < j and a(i) = a(j) = a(n/3) + 1 > 0, then i,j == 0 (mod 3), by induction hypothesis we have a(i/3) = a(j/3) = a(n/3), a contradiction.
(2) a(n) = A215879((n-5)/3) + 1 for n == 2 (mod 3) and n > 2.
If A215879((n-5)/3) = t, then n = 3*(Sum_{0<=r<=t-1} d_r*3^r + O(3^(t+1))) + 5, d_r = 1 or 2. Suppose that a(m) = A215879((m-5)/3) + 1 for m == 2 (mod 3) and 2 < n < m.
Obviously a(n) != 0. From (1) we know that a(3^e) = a(2*3^e) = t. For 1 <= e <= t, n - d_e*3^e = 3*(Sum_{0<=r<=t-1, r!=e-1} d_r*3^r + O(3^(t+1))) + 5 = 3*(Sum_{0<=r<=e-2} d_r*3^r + O(3^e)) + 5, so A215879((n-d_e*3^e-5)/3) = e-1. Since 5 <= n - d_e*3^e == 2 (mod 3), by induction hypothesis we have a(n-d_e*3^e) = e = a(d_e*3^e), so a(n) != e.
a(n) = t+1 is OK. Suppose otherwise that n = i+j, i != j and a(i) = a(j) = t+1 > 0, then {i,j} == {0,2} (mod 3) and i,j > 2. Suppose that i == 2 (mod 3), by induction hypothesis A215879((i-5)/3) = t. Write i = 3*(Sum_{0<=r<=t-1} d'_r*3^r + O(3^(t+1))) + 5, 1 <= d'_r <= d_r. If d'_r = d_r for all r, then j = n-i is divisible by 3^(t+2), so a(j) >= t+2, a contradiction. If d'_r != d_r for some r, then j = 3^(r_0+1) + O(3^(r_0+2)) where r_0 is the smallest index such that d'_r != d_r, so a(j) = r_0+1 + a(1+O(3^1)) = r_0+1 <= t, also a contradiction.
Recursive formulas:
a(n) = 0 for n = 2 or n == 1 (mod 3);
a(n) = 1 for n == 5 (mod 9);
a(n) = a(n/3) + 1 for n == 0 (mod 3);
a(n) = a((n+4)/3) + 1 for n == 2 (mod 9) and n > 2;
a(n) = a((n+7)/3) + 1 for n == 8 (mod 9).
Let A_1 = {3}, B_1 = {5}, A_{t+1} = {3*n: n in A_t, B_t}, B_{t+1} = {3*n-7, 3*n-4: n in B_t}, then for t >= 1, {n: a(n) = t} = (Union_{k>=0} {n+k*3^(t+1): n in A_t, B_t}) U {2*3^t}.
General formula: write n = s*3^t, gcd(s,3) = 1, then a(n) = t if s = 2 or s == 1 (mod 3), A215879((s-5)/3) + 1 + t otherwise. (End)

A005242 A self-generating sequence.

Original entry on oeis.org

1, 2, 4, 5, 8, 10, 12, 14, 15, 16, 19, 20, 21, 24, 25, 27, 28, 32, 33, 34, 37, 38, 40, 42, 43, 44, 46, 47, 48, 51, 53, 54, 56, 57, 58, 59, 61, 62, 63, 64, 66, 68, 69, 72, 73, 74, 77, 79, 81, 83, 84, 86, 88, 89, 91, 92, 94, 96, 97, 98, 100
Offset: 1

Views

Author

Keywords

Comments

Presumably this is the lexicographically earliest sequence of distinct positive numbers with the property that sums of two or three consecutive earlier terms are excluded. - N. J. A. Sloane, Jan 07 2021

References

  • R. K. Guy, Unsolved Problems in Number Theory, E30.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    import Data.List ((\\))
    a005242 n = a005242_list !! (n-1)
    a005242_list = f [1..] 0 0 where
       f (x:xs) y z = x : f (xs \\ [x + y, x + y + z]) x y
    -- Reinhard Zumkeller, May 23 2013

Extensions

More terms from Jud McCranie, Feb 15 1997

A062001 Table by antidiagonals of n-Stohr sequences: T(n,k) is least positive integer not the sum of at most n distinct terms in the n-th row from T(n,1) through to T(n,k-1).

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 4, 4, 2, 1, 5, 7, 4, 2, 1, 6, 10, 8, 4, 2, 1, 7, 13, 15, 8, 4, 2, 1, 8, 16, 22, 16, 8, 4, 2, 1, 9, 19, 29, 31, 16, 8, 4, 2, 1, 10, 22, 36, 46, 32, 16, 8, 4, 2, 1, 11, 25, 43, 61, 63, 32, 16, 8, 4, 2, 1, 12, 28, 50, 76, 94, 64, 32, 16, 8, 4, 2, 1, 13, 31, 57, 91, 125, 127, 64, 32, 16, 8, 4, 2, 1
Offset: 1

Views

Author

Henry Bottomley, May 29 2001

Keywords

Examples

			Array begins as:
  1, 2, 3, 4,  5,  6,  7,   8,   9, ... A000027;
  1, 2, 4, 7, 10, 13, 16,  19,  22, ... A033627;
  1, 2, 4, 8, 15, 22, 29,  36,  43, ... A026474;
  1, 2, 4, 8, 16, 31, 46,  61,  76, ... A051039;
  1, 2, 4, 8, 16, 32, 63,  94, 125, ... A051040;
  1, 2, 4, 8, 16, 32, 64, 127, 190, ... ;
  1, 2, 4, 8, 16, 32, 64, 128, 255, ... ;
  1, 2, 4, 8, 16, 32, 64, 128, 256, ... ;
  1, 2, 4, 8, 16, 32, 64, 128, 256, ... ;
Antidiagonal triangle begins as:
   1;
   2,  1;
   3,  2,  1;
   4,  4,  2,  1;
   5,  7,  4,  2,   1;
   6, 10,  8,  4,   2,   1;
   7, 13, 15,  8,   4,   2,  1;
   8, 16, 22, 16,   8,   4,  2,  1;
   9, 19, 29, 31,  16,   8,  4,  2,  1;
  10, 22, 36, 46,  32,  16,  8,  4,  2, 1;
  11, 25, 43, 61,  63,  32, 16,  8,  4, 2, 1;
  12, 28, 50, 76,  94,  64, 32, 16,  8, 4, 2, 1;
  13, 31, 57, 91, 125, 127, 64, 32, 16, 8, 4, 2, 1;
		

Crossrefs

Diagonals include A000079, A000225, A033484, A036563, A048487.
A048483 can be seen as half this table.

Programs

  • Mathematica
    T[n_, k_]:= If[kG. C. Greubel, May 03 2022 *)
  • SageMath
    def A062001(n,k):
        if (kA062001(n,k) for k in (1..n)] for n in (1..15)]) # G. C. Greubel, May 03 2022

Formula

If k <= n+1 then A(n, k) = 2^(k-1), while if k > n+1, A(n, k) = (2^n - 1)*(k - n) + 1 (array).
T(n, k) = A(k, n-k+1) (antidiagonals).
T(2*n-1, n) = A000079(n-1), n >= 1.
T(2*n, n) = A000079(n), n >= 1.
T(2*n+1, n) = A000225(n+1), n >= 1.
T(2*n+2, n) = A033484(n), n >= 1.
T(2*n+3, n) = A036563(n+3), n >= 1.
T(2*n+4, n) = A048487(n), n >= 1.
From G. C. Greubel, May 03 2022: (Start)
T(n, k) = (2^k - 1)*(n-2*k+1) + 1 for k < n/2, otherwise 2^(n-k).
T(2*n+5, n) = A048488(n), n >= 1.
T(2*n+6, n) = A048489(n), n >= 1.
T(2*n+7, n) = A048490(n), n >= 1.
T(2*n+8, n) = A048491(n), n >= 1.
T(2*n+9, n) = A139634(n), n >= 1.
T(2*n+10, n) = A139635(n), n >= 1.
T(2*n+11, n) = A139697(n), n >= 1. (End)

A075122 a(n) = least positive integer > a(n-1) and not a(i)+2*a(j) for 1<=i

Original entry on oeis.org

1, 2, 3, 4, 6, 12, 17, 18, 19, 20, 21, 22, 23, 24, 29, 31, 32, 33, 34, 73, 94, 96, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137
Offset: 1

Views

Author

Floor van Lamoen, Sep 02 2002

Keywords

Crossrefs

A350130 Integers m such that iterating the map f(x) = x^2 + 1 on m generates a number ending with m.

Original entry on oeis.org

0, 1, 2, 5, 6, 7, 26, 30, 77, 205, 330, 677, 802, 901, 1205, 2026, 4330, 4677, 7802, 8901, 48901, 52026, 71205, 74330, 107802, 152026, 271205, 474330, 904677, 948901, 2152026, 5904677, 7271205, 8948901, 9107802, 10474330, 22152026, 55904677, 77271205, 88948901
Offset: 1

Views

Author

Ya-Ping Lu, Dec 15 2021

Keywords

Comments

It takes 6 iterations for a term in the sequence to generate a number ending with the term itself. The numbers in the table below, except for those that begin with 0, are the terms with the numbers of digits (d) up to 10 in which the endings in the six iterations are: m1 -> m2 -> m3 -> m4 -> m5 -> m6 -> m1.
d m1 m2 m3 m4 m5 m6
-- ---------- ---------- ---------- ---------- ---------- ----------
1 0 1 2 5 6 7
2 30 01 02 05 26 77
3 330 901 802 205 026 677
4 4330 8901 7802 1205 2026 4677
5 74330 48901 07802 71205 52026 04677
6 474330 948901 107802 271205 152026 904677
7 0474330 8948901 9107802 7271205 2152026 5904677
8 10474330 88948901 89107802 77271205 22152026 55904677
9 510474330 588948901 989107802 977271205 122152026 455904677
10 6510474330 1588948901 9989107802 9977271205 8122152026 3455904677

Crossrefs

Programs

  • PARI
    isok(m) = {my(mm=m); for (i=1, 6, mm = mm^2+1;); !((mm-m) % 10^(#Str(m)));} \\ Michel Marcus, Feb 16 2022
  • Python
    for n in range(0, 10**11):
        s = len(str(n)); t = n; L = set()
        while t not in L:
            L.add(t); t = (t*t+1) % 10**s
            if t == n: print(n, end = ', ')
    

A193911 Sums of the diagonals of the matrix formed by listing the h-Stohr sequences in increasing order.

Original entry on oeis.org

1, 3, 7, 14, 25, 43, 69, 110, 167, 255, 375, 558, 805, 1179, 1681, 2438, 3451, 4975, 7011, 10070, 14153, 20283, 28461, 40734, 57103, 81663, 114415, 163550, 229069, 327355, 458409, 654998, 917123, 1310319, 1834587, 2620998, 3669553, 5242395, 7339525, 10485230
Offset: 1

Views

Author

Jeffrey R. Goodwin, Aug 08 2011

Keywords

Examples

			Portion of the first three rows:
A033627, 2-Stohr  1  2  4  7
A026474, 3-Stohr  1  2  4  8
A051039, 4-Stohr  1  2  4  8
Thus a(1)=1, a(2)=2+1=3, and a(3)=4+2+1=7.
		

Programs

Formula

All h-Stohr sequences have formula: h terms 1,2,..,2^(n-1),..,2^(h-1) and then continue (2^h-1)(n-h)+1. - Henry Bottomley, Feb 04 2000
So we get the sums from the piecewise function:
for odd n>=1, a(n)=2^((n+1)/2)-n+((n+1)/2)-2+Sum_{i=0..((n+1)/2)-1}(2*i+1)*(2^(((n+1)/2)-i) -1);
for even n>=2, a(n)=2^((n/2)+2)-n-4+Sum_{i=0..(n/2)-1}(2*i+1)*(2^((n/2)-i) -1). - Jeffrey R. Goodwin, Aug 09 2011
Let odd m>=3, then a(n)=a(m)-A000295(((m+1)/2)+1), where n>=2 is even. - Jeffrey R. Goodwin, Aug 09 2011
Let even m>=2, then a(n)=a(m)-A077802(m/2)=a(m)-A095151(m/2), where n>=1 is odd. - Jeffrey R. Goodwin, Aug 09 2011
From Alexander R. Povolotsky, Aug 09 2011: (Start)
G.f.: x*(1 + x - x^2)/((-1 + x)^3*(-1 - x + 2*x^2 + 2*x^3)).
a(n+4) = -2*a(n)+3*a(n+2)+n+5.
a(n) = 1/8*(2^(n/2+2)*((10-7*sqrt(2))*(-1)^n+10+7*sqrt(2))-(-1)^n-2*n*(n+12)-79). (End)

A244750 0-additive sequence: a(n) is the smallest number larger than a(n-1) which is not the sum of any subset of earlier terms, with initial values {0, 2, 3, 4}.

Original entry on oeis.org

0, 2, 3, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144
Offset: 1

Views

Author

Keywords

Examples

			a(5) cannot be 5=2+3. It cannot be 6=2+4. It cannot be 7=3+4, and becomes a(5)=8.
a(6) cannot be 9=2+3+4. It cannot be 10=2+8. It cannot be 11=3+8. It cannot be 12 = 4+8. It cannot be 13=2+3+8. It cannot be 14=2+4+8. It cannot be 15=3+4+8, and becomes a(6)=16.
		

References

  • R. K. Guy, "s-Additive sequences," preprint, 1994.

Crossrefs

Programs

  • Maple
    A244750:= proc(n)
        option remember;
        if n <= 4 then
            op(n,[0,2,3,4]);
        else
            prev := {seq(procname(k),k=1..n-1)} ;
            for a from procname(n-1)+1 do
                awrks := true ;
                for asub in combinat[choose](prev) do
                    if add(p,p=asub) = a then
                        awrks := false;
                        break;
                    end if;
                end do:
                if awrks then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    for n from 1 do
        print(A244750(n)) ;
    end do: # R. J. Mathar, Jul 12 2014
  • Mathematica
     f[s_List] := f[n] = Block[{k = s[[-1]] + 1, ss = Union[Plus @@@ Subsets[s]]}, While[ MemberQ[ss, k], k++]; Append[s, k]]; Nest[ f[#] &, {0, 2, 3, 4}, 16]

Extensions

Corrected by R. J. Mathar, Jul 12 2014

A271589 Array read by antidiagonals: column k lists the 2-Stöhr sequence composed of terms rejected from column k-1.

Original entry on oeis.org

1, 3, 2, 8, 5, 4, 17, 9, 6, 7, 44, 20, 11, 12, 10, 125, 47, 24, 15, 14, 13, 368, 128, 51, 26, 18, 21, 16, 1097, 371, 132, 53, 27, 35, 23, 19, 3284, 1100, 375, 134, 56, 29, 36, 30, 22, 9845, 3287, 1104, 377, 137, 60, 33, 38, 32, 25, 29528, 9848, 3291, 1106
Offset: 1

Views

Author

Max Barrentine, Apr 10 2016

Keywords

Comments

The first column of this array is the sequence that rejects the sum of any previous pair of terms (the 2-Stöhr sequence A033627). The second column takes the remaining numbers and rejects the sums of pairs of its previous terms, etc.
The first column consists of all numbers equivalent to 1 mod 3, and also 2. The second column consists of all numbers equivalent to 3 mod 9 and 5 mod 9, and also 6. The k-th column includes 3^k, 2*3^k, and 4*3^k, and in general every term in the (k-1)-th column multiplied by 3.

Examples

			From the top-left corner, this array starts:
1    3    8   17   44   125
2    5    9   20   47   128
4    6   11   24   51   132
7   12   15   26   53   134
10  14   18   27   56   137
13  21   35   29   60   141
		

Crossrefs

Cf. A033627.

A382109 a(n) is the index of the first Issai Schur additive sequence that will accept n.

Original entry on oeis.org

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

Views

Author

Gordon Hamilton, Mar 24 2025

Keywords

Comments

The Issai Schur additive sequences are greedily constructed so that no term in a sequence is the sum of two earlier terms in that sequence. Each positive integer is placed into exactly one additive sequence with priority given to the first sequence that will accept it.
This sequence can be explored by grade 2 students.
Junior high students can be asked what fraction of all numbers have a(n) = 1 (answer 1/3), a(n)=2 (answer 2/9)...
How does this greedy algorithm compare to the best possible results where we are trying to push the first occurrence of a(n) = k to happen for the largest possible n?

Examples

			Let's consider where the number 15 goes after the first 14 numbers have been placed:
Issai Schur additive sequence #1 {1,2,4,7,10,13}.
Issai Schur additive sequence #2 {3,5,6,12,14}.
Issai Schur additive sequence #3 {8,9,11}.
We always try to greedily add the next number in the lowest indexed sequence possible. "15" cannot go in #1 because 2+13 = 15. It cannot go in #2 because 3+12 = 15. It goes into #3 because no two distinct numbers in that additive sequence add to 15. So a(15) = 3
Where does 16 go? It can be added to #1, so a(16) = 1
Where does 17 go? It requires that we start a new additive sequence, #4, so a(17) = 4.
		

Crossrefs

Cf. A033627 is Issai Schur additive sequence #1.

Programs

  • PARI
    lista(n)={ my(a=vector(n), B=List(), L=List());
      for(n=1, n, my(k=1);
        while(k<=#L && bittest(L[k],n), k++);
        if(k>#L, listput(B,0); listput(L,0));
        a[n] = k; L[k] = bitor(L[k], B[k]<Andrew Howroyd, Mar 25 2025

Extensions

a(45) onwards from Andrew Howroyd, Mar 25 2025

A066512 Least nonnegative integer not the sum or product of any previous pair. a(1)=0.

Original entry on oeis.org

0, 0, 1, 2, 4, 7, 10, 13, 16, 19, 22, 25, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 94, 97, 103, 106, 109, 115, 118, 121, 126, 129, 135, 138, 141, 147, 150, 153, 158, 161, 164, 167, 170, 173, 176, 179, 182, 185, 193, 196, 199
Offset: 1

Views

Author

Brian Galebach, Jan 04 2002

Keywords

Examples

			a(13)=30, which is not a(i)+a(j) or a(i)*a(j) for any distinct i,j < 13.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        a, sums, products = [0], set(), set()
        yield from a
        for k in count(0):
            if k not in sums and k not in products:
                yield k
                sums.update(k+a[i] for i in range(len(a)))
                products.update(k*a[i] for i in range(len(a)))
                a.append(k)
            sums.discard(k)
            products.discard(k)
    print(list(islice(agen(), 61))) # Michael S. Branicky, Jun 09 2025
Previous Showing 21-30 of 35 results. Next