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.

Showing 1-6 of 6 results.

A008864 a(n) = prime(n) + 1.

Original entry on oeis.org

3, 4, 6, 8, 12, 14, 18, 20, 24, 30, 32, 38, 42, 44, 48, 54, 60, 62, 68, 72, 74, 80, 84, 90, 98, 102, 104, 108, 110, 114, 128, 132, 138, 140, 150, 152, 158, 164, 168, 174, 180, 182, 192, 194, 198, 200, 212, 224, 228, 230, 234, 240, 242, 252, 258, 264, 270, 272, 278, 282, 284
Offset: 1

Views

Author

Keywords

Comments

Sum of divisors of prime(n). - Labos Elemer, May 24 2001
For n > 1, there are a(n) more nonnegative Hurwitz quaternions than nonnegative Lipschitz quaternions, which are counted in A239396 and A239394, respectively. - T. D. Noe, Mar 31 2014
These are the numbers which are in A239708 or in A187813, but excluding the first 3 terms of A187813, i.e., a number m is a term if and only if m is a term > 2 of A187813, or m is the sum of two distinct powers of 2 such that m - 1 is prime. This means that a number m is a term if and only if m is a term > 2 such that there is no base b with a base-b digital sum of b, or b = 2 is the only base for which the base-b digital sum of m is b. a(6) is the only term such that a(n) = A187813(n); for n < 6, we have a(n) > A187813(n), and for n > 6, we have a(n) < A187813(n). - Hieronymus Fischer, Apr 10 2014
Does not contain any number of the format 1 + q + ... + q^e, q prime, e >= 2, i.e., no terms of A060800, A131991, A131992, A131993 etc. [Proof: that requires 1 + p = 1 + q + ... + q^e, or p = q*(1 + ... + q^(e-1)). This is not solvable because the left hand side is prime, the right hand side composite.] - R. J. Mathar, Mar 15 2018
1/a(n) is the asymptotic density of numbers whose prime(n)-adic valuation is odd. - Amiram Eldar, Jan 23 2021

References

  • C. W. Trigg, Problem #1210, Series Formation, J. Rec. Math., 15 (1982), 221-222.

Crossrefs

Column 1 of A341605, column 2 of A286623 and of A328464.
Partial sums of A125266.

Programs

Formula

a(n) = prime(n) + 1 = A000040(n) + 1.
a(n) = A000005(A034785(n)) = A000203(A000040(n)). - Labos Elemer, May 24 2001
a(n) = A084920(n) / A006093(n). - Reinhard Zumkeller, Aug 06 2007
A239703(a(n)) <= 1. - Hieronymus Fischer, Apr 10 2014
From Ilya Gutkovskiy, Jul 30 2016: (Start)
a(n) ~ n*log(n).
Product_{n>=1} (1 + 2/(a(n)*(a(n) - 2))) = 5/2. (End)

A187813 Numbers n whose base-b digit sum is not b for all bases b >= 2.

Original entry on oeis.org

0, 1, 2, 4, 8, 14, 30, 32, 38, 42, 44, 54, 60, 62, 74, 84, 90, 98, 102, 104, 108, 110, 114, 128, 138, 140, 150, 152, 158, 164, 168, 174, 180, 182, 194, 198, 200, 212, 224, 228, 230, 234, 240, 242, 252, 270, 278, 282, 284, 294, 308, 312, 314, 318, 332, 338, 348
Offset: 1

Views

Author

Tom Edgar, Aug 30 2013

Keywords

Comments

Except for 1, every number is even.
No number ends in 6.
Numbers neither in A018900 nor in A226636 nor in A226969 nor in A227062 nor in A227080 nor ... . - R. J. Mathar, Sep 02 2013
From Hieronymus Fischer, Mar 27 2014, May 09 2014: (Start)
A079696 and this sequence have no terms in common.
Numbers which satisfy m == 1 (mod j) and m > j^2 for any j > 1 are not terms.
Example 1: m = 10^k, k>1, is not a term since 10^k == 1 (mod 9) and 10^k > 9^2.
Example 2: m = 1 + 3k, k > 3, is not a term, since m > 3(1+3) > 3^2.
This is the complement of the disjunction of A079696 with A239708.
Disregarding the first 3 terms, these are the numbers which are in A008864 but not in A239708. This leads to the following characterization: A number m > 2 is a term, i.e., satisfies digitalSum_b(m) <> b for all b > 1, if and only m is a prime number + 1 and m is not the sum of two distinct powers of 2.
a(6) is the only term such that a(n) = Prime(n) + 1. For n < 6, we have a(n) < Prime(n) + 1, and for n > 6, we have a(n) > Prime(n) + 1.
(End)

Examples

			8 has binary expansion (1,0,0,0) whose digit sum 1 is not 2,
ternary expansion (2,2) whose digit sum 4 is not 3,
quaternary expansion (2,0) whose digit sum 2 is not 4,
5-ary expansion (1,3) whose digit sum 4 is not 5,
6-ary expansion (1,2) whose digit sum 3 is not 6,
7-ary expansion (1,1) whose digit sum 2 is not 7,
8-ary expansion (1,0) whose digit sum 1 is not 8,
and b-ary expansion (8) when b>8 whose digit sum is 8 not b. Therefore, 8 is in the sequence.
3 has binary expansion (1,1) whose digit sum is 2, so 3 is not in the sequence.
From _Hieronymus Fischer_, Apr 10 2014: (Start)
a(10) = 42 (the 13th prime + 1)
a(100) = 618 (the 113th prime + 1)
a(1000) = 8172 (the 1026th prime + 1)
a(10^4) = 105254 (the 10042nd prime + 1)
a(10^5) = 1300464 (the 100056th prime + 1)
a(10^6) = 15486872 (the 1000063th prime + 1)
a(10^7) = 179425944 (the 10000071st prime + 1)
a(10^8) = 2038076324 (the 10^8 +84th prime + 1)
a(10^9) = 22801765334 (the 10^9 +92nd prime + 1)
a(10^10) = 252097803264 (the 10^10 +102nd prime + 1)
[calculation for large numbers processed with Smalltalk method A187813With: estimate; see Prog section]
(End)
		

Crossrefs

Programs

  • Mathematica
    Q@n_:=AllTrue[Table[{b,Plus@@IntegerDigits[n,b]},{b,2,n}],#[[1]]!=#[[2]]&];
    Select[Range[0, 1000], Q] (* Hans Rudolf Widmer, Oct 08 2022 *)
  • Python
    from itertools import count, islice
    from sympy import isprime
    def A187813_gen(startvalue=0): # generator of terms >= startvalue
        yield from filter(lambda n:n<3 or (isprime(n-1) and n.bit_count()!=2), count(max(startvalue,0)))
    A187813_list = list(islice(A187813_gen(startvalue=20),30)) # Chai Wah Wu, Mar 24 2025
  • Sage
    n=1000 #change n for more terms
    S=[]
    for i in [0..n]:
        test=False
        for b in [2..i]:
            if sum(Integer(i).digits(base=b))==b:
                test=True
                break
        if not test:
            S.append(i)
    S
    # From Hieronymus Fischer, Apr 10 2014: (Start)
    
  • Smalltalk
    A187813NextTerm
      "Calculates the next term of A187813 greater than the receiver, i.e., calculates a(n+1) from a(n).
      Usage: a(n) A187813NextTerm
      Answer: a(n+1)
      Version 1: Using numOfBasesWithDigitalSumEQBase from A239703 ==> fast calculation, since only the divisors of  have to tested to be candidates for bases b with base-b digital sum equal to b"
      | an |
      an := self + 1.
      [an numOfBasesWithDigitalSumEQBase > 0]
      whileTrue: [an := an+1].
      ^an
    -----------
    A187813NextTerm
      "Calculates the next term of A187813 greater than the receiver, i.e., calculates a(n+1) from a(n).
      Usage: a(n) A187813NextTerm
      Answer: a(n+1)
      Version 2: Using the equivalence with A008864 and A239708 ==> even much more faster calculation"
      | p q |
      self < 0 ifTrue: [^0].
      self = 0 ifTrue: [^1].
      self = 1 ifTrue: [^2].
      p := (self - 1) nextPrime.
      q := p+1-(2 raisedToInteger: (p+1 integerFloorLog: 2)).
      [q > 0 and: [(2 raisedToInteger: (q integerFloorLog: 2)) - q = 0]] whileTrue: [p := p nextPrime.
                       q := p + 1 - (2 raisedToInteger: (p + 1 integerFloorLog: 2))].
      ^p + 1
    -----------
    A187813
      "Calculates the n-th term of A187813, iteratively.
      Usage: n A187813
      Answer: a(n)"
      | an n |
      n := self.
      n < 3 ifTrue: [^#(0 1) at: n].
      an := 2.
      4 to: n do: [:i |an := an A187813NextTerm].
      ^an
    -----------
    A187813rec
      "Calculates the n-th term of A187813, using the recursive method <A187813With: param>
      Usage: n A187813
      Answer: a(n)"
      self < 3 ifTrue: [^#(0 1) at: self].
      ^self A187813With: self prime
    -----------
    A187813With: estimate
    "Method to calculate the n-th term of A187813 based on the value estimate, recursively. The n-th prime is a adequate estimate. Valid for n > 2.
      Usage: n A187813With: estimate
      Answer: a(n)"
      | x m |
      (x:=((m:= estimate A239708inv)+self-3) prime + 1) = estimate
          ifFalse: [^self A187813With: x].
      (m + 1) A239708 = x
          ifTrue: [^self A187813With: x + 4].
      ^x
    [End]
    

Formula

From Hieronymus Fischer, Mar 27 2014: (Start)
A239703(a(n)) = 0.
a(n+1) = min (p > a(n) | A239703(p) = 0)
[for a Smalltalk implementation see Prog section, method A187813NextTerm version 1].
a(n+1) = 1 + min (p > a(n) | p is prime AND ((q := p+1 - 2^floor(log_2(p+1)) = 0) OR (2^floor(log_2(q)) <> q)))
[for a Smalltalk implementation see Prog section, method A187813NextTerm version 2].
a(n) > Prime(n), for n > 5.
a(n - m) < Prime(n), for n > 1, where m := i*(i-1)/2 + j - 1, i := floor(log_2(Prime(n))), j := floor(log_2(Prime(n) - 2^i)).
a(n - m) < Prime(n), for n > 32, where m := i*(i-1)/2 + j - 16 with i and j above.
a(n) = Prime(n + m - 3) + 1, where m = max ( k | A239708(k) < a(n)), n > 3.
Remark: This identity can be used to calculate a(n) recursively. For a Smalltalk implementation see Prog section, methods A187813rec and A187813With: estimate.
With same conditions: a(n) = A008864(n + m - 3).
a(n - m + 3) = Prime(n) + 1, where m = max ( k | A239708(k) < Prime(n)), n > 3, provided Prime(n) + 1 is not a term of A239708.
(End)

A072668 Numbers one less than composite numbers.

Original entry on oeis.org

3, 5, 7, 8, 9, 11, 13, 14, 15, 17, 19, 20, 21, 23, 24, 25, 26, 27, 29, 31, 32, 33, 34, 35, 37, 38, 39, 41, 43, 44, 45, 47, 48, 49, 50, 51, 53, 54, 55, 56, 57, 59, 61, 62, 63, 64, 65, 67, 68, 69, 71, 73, 74, 75, 76, 77, 79, 80, 81, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95
Offset: 1

Views

Author

Henry Bottomley, Apr 11 2001

Keywords

Comments

Complement of A006093 (primes minus 1).
Numbers which can be written as i*j+i+j, 0A072670(a(n))>0 for n>1.
a(n)! is divisible by a(n)*(a(n)+1)/2, see A060462.

Crossrefs

Programs

  • Magma
    [n-1: n in [2..120] | not IsPrime(n)]; // Vincenzo Librandi, Jun 09 2015
    
  • Mathematica
    Select[Range[4, 96], CompositeQ] - 1 (* Michael De Vlieger, Dec 10 2020 *)
  • PARI
    for(n=2,100,if(!isprime(n),print1(n-1,", "))) \\ Derek Orr, Jun 08 2015
    
  • Python
    from sympy import composite
    def A072668(n): return composite(n)-1 # Chai Wah Wu, Aug 02 2024

Formula

a(n) = A002808(n) - 1.
a(n) = 2*A002808(n) - A079696(n). - Juri-Stepan Gerasimov, Oct 22 2009
a(n) = A060462(n).

A239703 Number of bases b > 1 for which the base-b digital sum of n is b.

Original entry on oeis.org

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

Views

Author

Hieronymus Fischer, Mar 31 2014

Keywords

Comments

For the definition of the digital sum, see A007953.
For reference, we write digitSum_b(x) for the base-b digital sum of x according to A007953 (with general base b).
The bases counted exclude the special base 1. The base-1 expansion of a natural number is defined as 1=1_1, 2=11_1, 3=111_1 and so on. As a result, the base-1 digital sum of n is n. The inclusion of base b = 1 would lead to a(1) = 1 instead of a(1) = 0. All other terms remain unchanged.
For odd n > 1 and b := (n + 1)/2 we have digitSum_b(n) = b, and thus a(n) >= 1.
The digitSum_b(n) is < b for bases b which satisfy b > floor((n+1)/2), and thus a(n) <= floor((n+1)/2).
If b is a base such that the base-b digital sum of n is b, then b < n and b - 1 is a divisor of n - 1, thus the number of such bases is limited by the number of divisors of n - 1 (see formula section).
If p < n - 1 is a divisor of n - 1 which satisfy p >= sqrt(n - 1), then digitSum_b(n) = b for b := p + 1. This leads to a lower bound for a(n) (see formula section).
If b - 1 is a divisor of n - 1, then b is not necessarily a base such that base-b digital sum of n is b. Example: 1, 2, 3, 4, 6, 8, 12, 16, and 24 are the divisors < 48 of 48, but digitSum_2(49) = 3, digitSum_3(49) = 5, digitSum_5(49) = 9, digitSum_7(49) = 1.
a(b*n) > 0 for all b > 1 which satisfy digitSum_b(n) = b.
Example 1: digitSum_2(3) = 2, hence a(2*3) > 0.
Example 2: digitSum_3(5) = 3, hence a(3*5) > 0.
The first n with a(n) = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... are n = 3, 5, 17, 13, 31, 57, 37, 61, 81, 85, ... .

Examples

			a(1) = 1, since digitSum_1(1) = 1 and digitSum_b(1) <> b for all b > 1.
a(2) = 0, since digitSum_1(2) = 2 (because of 2 = 11_1), and digitSum_2(2) = 1 (because of 2 = 10_2), and digitSum_b(2) = 2 for all b > 2.
a(3) = 1, since digitSum_1(3) = 3 (because of 3 = 111_1), and digitSum_2(3) = 2 (because of 3 = 11_2), and digitSum_3(3) = 1 (because of 3 = 10_3), and digitSum_b(3) = 3 for all b > 3.
a(5) = 2, since digitSum_1(5) = 5 (because of 5 = 11111_1), and digitSum_2(5) = 2 (because of 5 = 101_2), and digitSum_3(5) = 3 (because of 5 = 12_3), and digitSum_4(5) = 2 (because of 5 = 11_4), and digitSum_5(5) = 1 (because of 5 = 10_5), and digitSum_b(5) = 5 for all b > 5.
		

Crossrefs

Cf. A000040; A000005 (definition of sigma_0(n)).

Programs

  • Smalltalk
    "> Version 1: simple calculation for small numbers.
      Answer the number of bases b such that the digital sum of n in base b is b.
      Valid for bases b >= 1, thus returning a(1) = 1.
      Using digitalSum from A007953.
      Usage: n numOfBasesWithAltDigitalSumEQBase
      Answer: a(n)"
    numOfBasesWithDigitalSumEQBase
      | numBases b bmax |
      numBases := 0.
      bmax := self + 1 // 2.
      b := 0.
      [b < bmax] whileTrue: [
         b := b + 1
         (self digitalSum: b) = b
         ifTrue: [numBases := numBases + 1]].
      ^numBases
    -----------
    "> Version 2: accelerated calculation for large numbers.
      Answer the number of bases b such that the digital sum of n in base b is b.
      Valid for bases b > 1, thus returning a(1) = 0.
      Using digitalSum from A007953.
      Usage: n numOfBasesWithAltDigitalSumEQBase
      Answer: a(n)"
    numOfBasesWithDigitalSumEQBase
      | numBases div b bsize |
      self < 3 ifTrue: [^0].
      div := (self - 1) divisors.
      numBases := 0.
      bsize := div size - 1.
      1 to: bsize do: [ :i | b := (div at: i) + 1.
       (self digitalSum: b) = b
           ifTrue: [numBases := numBases + 1] ].
      ^numBases

Formula

a(n) = 0, if and only if n is a term of A187813.
a(A187813(n)) = 0.
a(A239708(n)) = 1, for n > 0.
a(A018900(n)) > 0, for n > 0.
a(A079696(n)) > 0, for n > 0.
a(A008864(n)) <= 1, for n > 0.
a(n) <= 1, if n - 1 is a prime.
a(n) <= sigma_0(n - 1) - 1, for n > 1.
a(n) >= floor((sigma_0(n-1)-1)/2), for n > 1.

A239708 Numbers of the form m = 2^i + 2^j, where i > j >= 0, such that m - 1 is prime.

Original entry on oeis.org

3, 6, 12, 18, 20, 24, 48, 68, 72, 80, 132, 192, 258, 264, 272, 384, 1032, 1040, 1088, 1152, 1280, 2064, 2112, 4100, 4112, 4128, 4160, 5120, 6144, 8448, 16448, 20480, 32772, 32784, 32832, 33024, 33792, 65538, 65540, 65544, 65552, 65600, 66048, 73728, 81920, 262148, 262152, 262272, 262400, 263168, 266240, 294912, 524352, 528384, 786432
Offset: 1

Views

Author

Hieronymus Fischer, Mar 27 2014

Keywords

Comments

Complement of the disjunction of A079696 with A187813. This means that a number m is a term if and only if b = 2 is the only base for which the base-b digital sum of m is b.

Examples

			a(1) = 3, since 3 = 2^1 + 2^0.
a(3) = 12, since 12 = 2^3 + 2^2.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from sympy import isprime
    def A239708_gen(): # generator of terms
        yield (n:=3)
        while True:
            n = n^((a:=-n&n+1)|(a>>1)) if n&1 else ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b
            if isprime(n-1):
                yield n
    A239708_list = list(islice(A239708_gen(),30)) # Chai Wah Wu, Mar 24 2025
  • Smalltalk
    A239708
    "Answers the n-th term of A239708.
      Usage: n A239708
      Answer: a(n)"
      | a b i k m p q terms |
      terms := OrderedCollection new.
      b := 2.
      p := 1.
      k := 0.
      m := 0.
      [k < self] whileTrue:
             [m := m + 1.
             p := b * p.
             q := 1.
             i := 0.
             [i < m and: [k < self]] whileTrue:
                       [i := i + 1.
                       a := p + q.
                       (a - 1) isPrime
                            ifTrue:
                                [k := k + 1.
                                terms add: a].
                       q := b * q]].
      ^terms at: self
    -----------------
    
  • Smalltalk
    A239708inv
      "Answers a kind of inverse of A239708.
      Usage: n A239708inv
      Answer: max ( k | A239708(k) < n)"
      | k |
      k := 1.
      [k A239708 < self] whileTrue: [k := k + 1].
      ^k - 1
    

Formula

A239703(a(n)) = 1.

A352447 Numbers k such that BarnesG(k) is divisible by Gamma(k).

Original entry on oeis.org

1, 2, 7, 9, 10, 11, 13, 15, 16, 17, 19, 21, 22, 23, 25, 26, 27, 28, 29, 31, 33, 34, 35, 36, 37, 39, 40, 41, 43, 45, 46, 47, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 61, 63, 64, 65, 66, 67, 69, 70, 71, 73, 75, 76, 77, 78, 79, 81, 82, 83, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95
Offset: 1

Views

Author

Vladimir Reshetnikov, Mar 16 2022

Keywords

Comments

These are k such that G(k)/Gamma(k) = 1!*2!*3!*...*(k-2)!/(k-1)! = 1!*2!*3!*...*(k-3)!/(k-1) are integer. Let k=1+c, so require 1!*2!*3!*...*(c-2)!/c to be integer. If c is composite, take any factorization of c=c_1*c_2 with 2<=c_1<=c_2<=c/2; then matching factors exist in the product 1!*2!*3!*...*(c-2)! that cancel this factor [either c_1! and c_2! if c_1 <> c_2, or c_1! and (c_1+1)! if c_1=c_2 and c-2 >= c_1+1]. If c is prime, none of the 1!*2!*..(c-2)! contains a factor matching that prime. So this shows that the sequence is (apart from offset and at c=4) the same as A079696. - R. J. Mathar, Mar 25 2022

Examples

			BarnesG(7) = 34560, Gamma(7) = 720, 34560 is divisible by 720, so 7 is in this sequence.
		

Crossrefs

Programs

  • Mathematica
    Table[If[Divisible[BarnesG[k], Gamma[k]], k, Nothing], {k, 115}]
  • Python
    from itertools import count, islice
    from collections import Counter
    from sympy import factorint
    def A352447_gen(): # generator of terms
        yield 1
        a = Counter()
        for k in count(2):
            b = Counter(factorint(k-1))
            if all(b[p] <= a[p] for p in b):
                yield k
            a += b
    A352447_list = list(islice(A352447_gen(),100)) # Chai Wah Wu, Mar 17 2022

Formula

Conjecture: a(n) = A079696(n-1), n>1. - R. J. Mathar, Mar 20 2022
Showing 1-6 of 6 results.