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-10 of 74 results. Next

A053289 First differences of consecutive perfect powers (A001597).

Original entry on oeis.org

3, 4, 1, 7, 9, 2, 5, 4, 13, 15, 17, 19, 21, 4, 3, 16, 25, 27, 20, 9, 18, 13, 33, 35, 19, 18, 39, 41, 43, 28, 17, 47, 49, 51, 53, 55, 57, 59, 61, 39, 24, 65, 67, 69, 71, 35, 38, 75, 77, 79, 81, 47, 36, 85, 87, 89, 23, 68, 71, 10, 12, 95, 97, 99, 101, 103, 40, 65, 107, 109, 100
Offset: 1

Views

Author

Labos Elemer, Mar 03 2000

Keywords

Comments

Michel Waldschmidt writes: Conjecture 1.3 (Pillai). Let k be a positive integer. The equation x^p - y^q = k where the unknowns x, y, p and q take integer values, all >= 2, has only finitely many solutions (x,y,p,q). This means that in the increasing sequence of perfect powers [A001597] the difference between two consecutive terms [the present sequence] tends to infinity. It is not even known whether for, say, k=2, Pillai's equation has only finitely many solutions. A related open question is whether the number 6 occurs as a difference between two perfect powers. See Sierpiński [1970], problem 238a, p. 116. - Jonathan Vos Post, Feb 18 2008
Are there are any adjacent equal terms? - Gus Wiseman, Oct 08 2024

Examples

			Consecutive perfect powers are A001597(14) = 121, A001597(13) = 100, so a(13) = 121 - 100 = 21.
		

References

  • Wacław Sierpiński, 250 problems in elementary number theory, Modern Analytic and Computational Methods in Science and Mathematics, No. 26, American Elsevier, Warsaw, 1970, pp. 21, 115-116.
  • S. S. Pillai, On the equation 2^x - 3^y = 2^X - 3^Y, Bull, Calcutta Math. Soc. 37 (1945) 15-20.

Crossrefs

For non-perfect-powers (A007916) we have A375706.
The union is A023055.
For prime-powers (A000961 or A246655) we have A057820.
Sorted positions of first appearances are A376268, complement A376519.
For second differences we have A376559.
Ascending and descending points are A376560 and A376561.
A001597 lists perfect-powers.
A112344 counts integer partitions into perfect-powers, factorizations A294068.
A333254 gives run-lengths of differences between consecutive primes.

Programs

  • Mathematica
    Differences@ Select[Range@ 3200, # == 1 || GCD @@ FactorInteger[#][[All, 2]] > 1 &] (* Michael De Vlieger, Jun 30 2016, after Ant King at A001597 *)
  • Python
    from sympy import mobius, integer_nthroot
    def A053289(n):
        if n==1: return 3
        def f(x): return int(n-2+x+sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(2,x.bit_length())))
        kmin, kmax = 1,2
        while f(kmax)+1 >= kmax:
            kmax <<= 1
        rmin, rmax = 1, kmax
        while True:
            kmid = kmax+kmin>>1
            if f(kmid)+1 < kmid:
                kmax = kmid
            else:
                kmin = kmid
            if kmax-kmin <= 1:
                break
        while True:
            rmid = rmax+rmin>>1
            if f(rmid) < rmid:
                rmax = rmid
            else:
                rmin = rmid
            if rmax-rmin <= 1:
                break
        return kmax-rmax # Chai Wah Wu, Aug 13 2024

Formula

a(n) = A001597(n+1) - A001597(n). - Jonathan Vos Post, Feb 18 2008
From Amiram Eldar, Jun 30 2023: (Start)
Formulas from Jakimczuk (2016):
Lim sup_{n->oo} a(n)/(2*n) = 1.
Lim inf_{n->oo} a(n)/(2*n)^(2/3 + eps) = 0. (End)
Can be obtained by inserting 0 between 3 and 6 in A375702 and then adding 1 to all terms. In particular, for n > 2, a(n+1) - 1 = A375702(n). - Gus Wiseman, Sep 14 2024

A029707 Numbers n such that the n-th and the (n+1)-st primes are twin primes.

Original entry on oeis.org

2, 3, 5, 7, 10, 13, 17, 20, 26, 28, 33, 35, 41, 43, 45, 49, 52, 57, 60, 64, 69, 81, 83, 89, 98, 104, 109, 113, 116, 120, 140, 142, 144, 148, 152, 171, 173, 176, 178, 182, 190, 201, 206, 209, 212, 215, 225, 230, 234, 236, 253, 256, 262, 265, 268, 277
Offset: 1

Views

Author

N. J. A. Sloane, Dec 11 1999

Keywords

Comments

Numbers m such that prime(m)^2 == 1 mod (prime(m) + prime(m + 1)). - Zak Seidov, Sep 18 2013
First differences are A027833. The complement is A049579. - Gus Wiseman, Dec 03 2024

Crossrefs

Cf. A014574, A027833 (first differences), A007508. Equals PrimePi(A001359) (cf. A000720).
The complement is A049579, first differences A251092 except first term.
Lengths of runs of terms differing by 2 are A179067.
The first differences have run-lengths A373820 except first term.
A000040 lists the primes, differences A001223 (run-lengths A333254, A373821).
A038664 finds the first prime gap of 2n.
A046933 counts composite numbers between primes.
For prime runs: A005381, A006512, A025584, A067774.

Programs

  • Maple
    A029707 := proc(n)
        numtheory[pi](A001359(n)) ;
    end proc:
    seq(A029707(n),n=1..30); # R. J. Mathar, Feb 19 2017
  • Mathematica
    Select[ Range@300, PrimeQ[ Prime@# + 2] &] (* Robert G. Wilson v, Mar 11 2007 *)
    Flatten[Position[Flatten[Differences/@Partition[Prime[Range[100]],2,1]], 2]](* Harvey P. Dale, Jun 05 2014 *)
  • Sage
    def A029707(n) :
       a = [ ]
       for i in (1..n) :
          if (nth_prime(i+1)-nth_prime(i) == 2) :
             a.append(i)
       return(a)
    A029707(277) # Jani Melik, May 15 2014

Formula

a(n) = A107770(n) - 1. - Juri-Stepan Gerasimov, Dec 16 2009

A064113 Indices k such that (1/3)*(prime(k)+prime(k+1)+prime(k+2)) is a prime.

Original entry on oeis.org

2, 15, 36, 39, 46, 54, 55, 73, 102, 107, 110, 118, 129, 160, 164, 184, 187, 194, 199, 218, 239, 271, 272, 291, 339, 358, 387, 419, 426, 464, 465, 508, 520, 553, 599, 605, 621, 629, 633, 667, 682, 683, 702, 709, 710, 733, 761, 791, 813, 821, 822, 829, 830
Offset: 1

Views

Author

Jason Earls, Sep 08 2001

Keywords

Comments

n such that d(n) = d(n+1), where d(n) = prime(n+1) - prime(n) = A001223(n).
Of interest because when I generalize it to d(n) = d(n+2), d(n) = d(n+3), etc. I am unable to find any positive number k such that d(n) = d(n+k) has no solution.
From Lei Zhou, Dec 06 2005: (Start)
When (1/3)*(prime(k) + prime(k+1) + prime(k+2)) is prime, then it is equal to prime(k+1).
Also, indices k such that (prime(k)+prime(k+2))/2 = prime(k+1).
The Mathematica program is based on the alternative definition. (End)
Inflection and undulation points of the primes, i.e., positions of zeros in A036263, the second differences of the primes. - Gus Wiseman, Mar 24 2020

Examples

			a(2) = 15 because (p(15)+p(16)+p(17)) = 1/3(47 + 53 + 59) = 53 (prime average of three successive primes).
Splitting the prime gaps into anti-runs gives: (1,2), (2,4,2,4,2,4,6,2,6,4,2,4,6), (6,2,6,4,2,6,4,6,8,4,2,4,2,4,14,4,6,2,10,2,6), (6,4,6), ... Then a(n) is the n-th partial sum of the lengths of these anti-runs. - _Gus Wiseman_, Mar 24 2020
		

Crossrefs

Indices of zeros in A036263 (second differences of primes).
Indices (A000720 = primepi) of balanced primes A006562, minus 1.
Cf. A262138.
Complement of A333214.
First differences are A333216.
The version for strict ascents is A258025.
The version for strict descents is A258026.
The version for weak ascents is A333230.
The version for weak descents is A333231.
A triangle for anti-runs of compositions is A106356.
Lengths of maximal runs of prime gaps are A333254.
Anti-runs of compositions in standard order are A333381.

Programs

  • Haskell
    import Data.List (elemIndices)
    a064113 n = a064113_list !! (n-1)
    a064113_list = map (+ 1) $ elemIndices 0 a036263_list
    -- Reinhard Zumkeller, Jan 20 2012
    
  • Mathematica
    ct = 0; Do[If[(Prime[k] + Prime[k + 2] - 2*Prime[k + 1]) == 0, ct++; n[ct] = k], {k, 1, 2000}]; Table[n[k], {k, 1, ct}] (* Lei Zhou, Dec 06 2005 *)
    Join@@Position[Differences[Array[Prime,100],2],0] (* Gus Wiseman, Mar 24 2020 *)
  • PARI
    d(n) = prime(n+1)-prime(n); j=[]; for(n=1,1500, if(d(n)==d(n+1), j=concat(j,n))); j
    
  • PARI
    { n=0; for (m=1, 10^9, if (d(m)==d(m+1), write("b064113.txt", n++, " ", m); if (n==1000, break)) ) } \\ Using d(n) above. - Harry J. Smith, Sep 07 2009
    
  • PARI
    [n | n<-[1..888], !A036263(n)] \\ M. F. Hasler, Oct 15 2024
    
  • PARI
    \\ More efficient for larges range of n:
    A064113_upto(N, n=1, L=List(), q=prime(n+1), d=q-prime(n))={forprime(p=1+q,, if(d==d=p-q, listput(L,n); #LM. F. Hasler, Oct 15 2024
    
  • Python
    from itertools import count, islice
    from sympy import prime, nextprime
    def A064113_gen(startvalue=1): # generator of terms >= startvalue
        c = max(startvalue,1)
        p = prime(c)
        q = nextprime(p)
        r = nextprime(q)
        for k in count(c):
            if p+r==(q<<1):
                yield k
            p, q, r = q, r, nextprime(r)
    A064113_list = list(islice(A064113_gen(),20)) # Chai Wah Wu, Feb 27 2024

Formula

A036263(a(n)) = 0; A122535(n) = A000040(a(n)); A006562(n) = A000040(a(n) + 1); A181424(n) = A000040(a(n) + 2). - Reinhard Zumkeller, Jan 20 2012
A262138(2*a(n)) = 0. - Reinhard Zumkeller, Sep 12 2015
a(n) = A000720(A006562(n)) - 1, where A000720 = (prime)pi, A006562 = balanced primes. - M. F. Hasler, Oct 15 2024

A376593 Second differences of consecutive nonsquarefree numbers (A013929). First differences of A078147.

Original entry on oeis.org

-3, 2, 1, -2, 0, 2, -3, 1, -1, 3, 0, 0, 0, -3, 2, -2, 0, 1, 0, 0, 2, -1, -2, 3, 0, -1, -2, 3, -3, 2, 1, -2, 0, 2, -2, -1, 0, 3, 0, 0, 0, -3, 2, -2, 2, -2, 0, 1, 2, -1, -2, 3, 0, -1, -2, 1, 0, -1, 2, 1, -2, 0, 2, -3, 1, -1, 2, -2, 3, 0, 0, -3, 2, 1, -2, 0, 2
Offset: 1

Views

Author

Gus Wiseman, Oct 01 2024

Keywords

Comments

The range is {-3, -2, -1, 0, 1, 2, 3}.

Examples

			The nonsquarefree numbers (A013929) are:
  4, 8, 9, 12, 16, 18, 20, 24, 25, 27, 28, 32, 36, 40, 44, 45, 48, 49, 50, 52, ...
with first differences (A078147):
  4, 1, 3, 4, 2, 2, 4, 1, 2, 1, 4, 4, 4, 4, 1, 3, 1, 1, 2, 2, 2, 4, 3, 1, 4, 4, ...
with first differences (A376593):
  -3, 2, 1, -2, 0, 2, -3, 1, -1, 3, 0, 0, 0, -3, 2, -2, 0, 1, 0, 0, 2, -1, -2, ...
		

Crossrefs

The version for A000002 is A376604, first differences of A054354.
The first differences were A078147.
Zeros are A376594, complement A376595.
A000040 lists the prime numbers, differences A001223.
A005117 lists squarefree numbers, differences A076259.
A064113 lists positions of adjacent equal prime gaps.
A114374 counts partitions into nonsquarefree numbers.
A246655 lists prime-powers exclusive, inclusive A000961.
A333254 lists run-lengths of differences between consecutive primes.
For second differences: A036263 (prime), A073445 (composite), A376559 (perfect-power), A376562 (non-perfect-power), A376590 (squarefree), A376596 (prime-power inclusive), A376599 (non-prime-power inclusive).
For nonsquarefree numbers: A013929 (terms), A078147 (first differences), A376594 (inflections and undulations), A376595 (nonzero curvature).

Programs

  • Mathematica
    Differences[Select[Range[100],!SquareFreeQ[#]&],2]
  • Python
    from math import isqrt
    from sympy import mobius, factorint
    def A376593(n):
        def f(x): return n+sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        k = next(i for i in range(1,5) if any(d>1 for d in factorint(m+i).values()))
        return next(i for i in range(1-k,5-k) if any(d>1 for d in factorint(m+(k<<1)+i).values())) # Chai Wah Wu, Oct 02 2024

A037201 Differences between consecutive primes (A001223) but with repeats omitted.

Original entry on oeis.org

1, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, 14, 4, 6, 2, 10, 2, 6, 4, 6, 2, 10, 2, 4, 2, 12, 4, 2, 4, 6, 2, 10, 6, 2, 6, 4, 2, 10, 14, 4, 2, 4, 14, 6, 10, 2, 4, 6, 8, 6, 4, 6, 8, 4, 8, 10, 2, 10, 2, 6, 4, 6, 8, 4
Offset: 1

Views

Author

Keywords

Comments

Also the run-compression of the sequence of first differences of prime numbers, where we define the run-compression of a sequence to be the anti-run obtained by reducing each run of repeated parts to a single part. Alternatively, we can remove all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has run-compression (1,2,1). - Gus Wiseman, Sep 16 2024

Crossrefs

This is the run-compression of A001223 = first differences of A000040.
The repeats were at positions A064113 before being omitted.
Adding up runs instead of compressing them gives A373822.
The even terms halved are A373947.
For prime-powers instead of prime numbers we have A376308.
Positions of first appearances are A376520, sorted A376521.
A003242 counts compressed compositions.
A333254 lists run-lengths of differences between consecutive primes.
A373948 encodes compression using compositions in standard order.

Programs

  • Haskell
    a037201 n = a037201_list !! (n-1)
    a037201_list = f a001223_list where
       f (x:xs@(x':_)) | x == x'   = f xs
                       | otherwise = x : f xs
    -- Reinhard Zumkeller, Feb 27 2012
    
  • Mathematica
    Flatten[Split[Differences[Prime[Range[150]]]]/.{(k_)..}:>k] (* based on a program by Harvey P. Dale, Jun 21 2012 *)
  • PARI
    t=0;p=2;forprime(q=3,1e3,if(q-p!=t,print1(q-p", "));t=q-p;p=q) \\ Charles R Greathouse IV, Feb 27 2012

Formula

a(n>1) = 2*A373947(n-1). - Gus Wiseman, Sep 16 2024

Extensions

Offset corrected by Reinhard Zumkeller, Feb 27 2012

A333214 Positions of adjacent unequal terms in the sequence of differences between primes.

Original entry on oeis.org

1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75
Offset: 1

Views

Author

Gus Wiseman, Mar 15 2020

Keywords

Examples

			The sequence of differences between primes splits into the following runs: (1), (2,2), (4), (2), (4), (2), (4), (6), (2), (6), (4), (2), (4), (6,6), (2), (6), (4), (2), (6), (4), (6).
		

Crossrefs

The version for the Kolakoski sequence is A054353.
Complement of A064113 (the version for adjacent equal terms).
Runs of compositions in standard order are counted by A124767.
A triangle for runs of compositions is A238279.
The version for strict ascents is A258025.
The version for strict descents is A258026.
The version for weak ascents is A333230.
The version for weak descents is A333231.
First differences are A333254 (if the first term is 0).

Programs

  • Mathematica
    Accumulate[Length/@Split[Differences[Array[Prime,100]],#1==#2&]]//Most
    - or -
    Select[Range[100],Prime[#+1]-Prime[#]!=Prime[#+2]-Prime[#+1]&]

Formula

Numbers k such that prime(k+1) - prime(k) != prime(k+2) - prime(k+1).

A073445 Second differences of A002808, the sequence of composites.

Original entry on oeis.org

0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 1, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 1, -1, 0, 1, 0, -1, 0, 0, 0, 1, -1, 0, 1, -1, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 1, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0
Offset: 1

Views

Author

Labos Elemer, Aug 01 2002

Keywords

Examples

			From _Gus Wiseman_, Oct 10 2024: (Start)
The composite numbers (A002808) are:
  4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, ...
with first differences (A073783):
  2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, ...
with first differences (A073445):
  0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 1, -1, ...
(End)
		

Crossrefs

Also first differences of A054546.
For first differences we had A073783 (ones A375929), run-lengths A376680.
Positions of zeros are A376602.
Positions of nonzeros are A376603.
Positions of ones are A376651, negative-ones A376652.
A002808 lists the composite numbers.
A064113 lists positions of adjacent equal prime gaps.
A333254 gives run-lengths of differences between consecutive primes.
Other second differences: A036263 (prime), A376590 (squarefree), A376596 (prime-power), A376604 (Kolakoski).

Programs

  • Haskell
    a073445 n = a073445_list !! (n-1)
    a073445_list = zipWith (-) (tail a073783_list) a073783_list
    -- Reinhard Zumkeller, Jan 10 2013
    
  • Mathematica
    c[x_] := FixedPoint[x+PrimePi[ # ]+1&, x]; Table[c[w+2]-2*c[w+1]+c[w], {w, 200}]
    (* second program *)
    Differences[Select[Range[100],CompositeQ],2] (* Gus Wiseman, Oct 08 2024 *)
  • Python
    from sympy import primepi
    def A073445(n):
        def iterfun(f,n=0):
            m, k = n, f(n)
            while m != k: m, k = k, f(k)
            return m
        return (a:=iterfun(f:=lambda x:n+primepi(x)+1,n))-((b:=iterfun(lambda x:f(x)+1,a))<<1)+iterfun(lambda x:f(x)+2,b) # Chai Wah Wu, Oct 03 2024

Formula

a(n) = c(n+2)-2*c(n+1)+c(n), where c(n) = A002808(n).
a(n) = A073783(n+1) - A073783(n). - Reinhard Zumkeller, Jan 10 2013

A095195 T(n,0) = prime(n), T(n,k) = T(n,k-1)-T(n-1,k-1), 0<=k

Original entry on oeis.org

2, 3, 1, 5, 2, 1, 7, 2, 0, -1, 11, 4, 2, 2, 3, 13, 2, -2, -4, -6, -9, 17, 4, 2, 4, 8, 14, 23, 19, 2, -2, -4, -8, -16, -30, -53, 23, 4, 2, 4, 8, 16, 32, 62, 115, 29, 6, 2, 0, -4, -12, -28, -60, -122, -237, 31, 2, -4, -6, -6, -2, 10, 38, 98, 220, 457, 37, 6, 4, 8, 14, 20, 22, 12
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 22 2004

Keywords

Comments

T(n,0)=A000040(n); T(n,1)=A001223(n-1) for n>1; T(n,2)=A036263(n-2) for n>2; T(n,n-1)=A007442(n) for n>1.
Row k of the array (not the triangle) is the k-th differences of the prime numbers. - Gus Wiseman, Jan 11 2025

Examples

			Triangle begins:
   2;
   3,  1;
   5,  2,  1;
   7,  2,  0, -1;
  11,  4,  2,  2,  3;
  13,  2, -2, -4, -6, -9;
Alternative: array form read by antidiagonals:
     2,   3,   5,   7,  11,  13,  17,  19,  23,  29,  31,...
     1,   2,   2,   4,   2,   4,   2,   4,   6,   2,   6,...
     1,   0,   2,  -2,   2,  -2,   2,   2,  -4,   4,  -2,...
    -1,   2,  -4,   4,  -4,   4,   0,  -6,   8,  -6,   0,...
     3,  -6,   8,  -8,   8,  -4,  -6,  14, -14,   6,   4,...
    -9,  14, -16,  16, -12,  -2,  20, -28,  20,  -2,  -8,...
    23, -30,  32, -28,  10,  22, -48,  48, -22,  -6,  10,..,
   -53,  62, -60,  38,  12, -70,  96, -70,  16,  16, -12,...
   115,-122,  98, -26, -82, 166,-166,  86,   0, -28,  28,...
  -237, 220,-124, -56, 248,-332, 252, -86, -28,  56, -98,...
   457,-344,  68, 304,-580, 584,-338,  58,  84,-154, 308,...
		

Crossrefs

Cf. A140119 (row sums).
Below, the inclusive primes (A008578) are 1 followed by A000040. See also A075526.
Rows of the array (columns of the triangle) begin: A000040, A001223, A036263.
Column n = 1 of the array is A007442, inclusive A030016.
The version for partition numbers is A175804, see A053445, A281425, A320590.
First position of 0 is A376678, inclusive A376855.
Absolute antidiagonal-sums are A376681, inclusive A376684.
The inclusive version is A376682.
For composite instead of prime we have A377033, see A377034-A377037.
For squarefree instead of prime we have A377038, nonsquarefree A377046.
Column n = 2 of the array is A379542.

Programs

  • Haskell
    a095195 n k = a095195_tabl !! (n-1) !! (k-1)
    a095195_row n = a095195_tabl !! (n-1)
    a095195_tabl = f a000040_list [] where
       f (p:ps) xs = ys : f ps ys where ys = scanl (-) p xs
    -- Reinhard Zumkeller, Oct 10 2013
  • Maple
    A095195A := proc(n,k) # array, k>=0, n>=0
        option remember;
        if n =0 then
            ithprime(k+1) ;
        else
            procname(n-1,k+1)-procname(n-1,k) ;
        end if;
    end proc:
    A095195 := proc(n,k) # triangle, 0<=k=1
            A095195A(k,n-k-1) ;
    end proc: # R. J. Mathar, Sep 19 2013
  • Mathematica
    T[n_, 0] := Prime[n]; T[n_, k_] /; 0 <= k < n := T[n, k] = T[n, k-1] - T[n-1, k-1]; Table[T[n, k], {n, 1, 12}, {k, 0, n-1}] // Flatten (* Jean-François Alcover, Feb 01 2017 *)
    nn=6;
    t=Table[Differences[Prime[Range[nn]],k],{k,0,nn}];
    Table[t[[j,i-j+1]],{i,nn},{j,i}] (* Gus Wiseman, Jan 11 2025 *)

A068361 Numbers n such that the number of squarefree numbers between prime(n) and prime(n+1) = prime(n+1)-prime(n)-1.

Original entry on oeis.org

1, 3, 10, 13, 26, 33, 60, 89, 104, 113, 116, 142, 148, 201, 209, 212, 234, 265, 268, 288, 313, 320, 332, 343, 353, 384, 398, 408, 477, 484, 498, 542, 545, 551, 577, 581, 601, 625, 636, 671, 719, 723, 726, 745, 794, 805, 815, 862, 864, 884, 944, 964, 995, 1054
Offset: 1

Views

Author

Benoit Cloitre, Feb 28 2002

Keywords

Comments

Also numbers k such that all numbers from prime(k) to prime(k+1) are squarefree. All such primes are twins, so this is a subset of A029707. The other twin primes are A061368. - Gus Wiseman, Dec 11 2024

Crossrefs

A subset of A029707 (lesser index of twin primes).
Prime index of each (prime) term of A061351.
Positions of zeros in A061399.
For perfect power instead of squarefree we have A377436, zeros of A377432.
Positions of zeros in A377784.
The rest of the twin primes are at A378620, indices of A061368.
A000040 lists the primes, differences A001223, (run-lengths A333254, A373821).
A005117 lists the squarefree numbers, differences A076259.
A006562 finds balanced primes.
A013929 lists the nonsquarefree numbers, differences A078147.
A014574 is the intersection of A006093 and A008864.
A038664 locates the first prime gap of size 2n.
A046933 counts composite numbers between primes.
A061398 counts squarefree numbers between primes, zeros A068360.
A120327 gives the least nonsquarefree number >= n.

Programs

  • Mathematica
    Select[Range[100],And@@SquareFreeQ/@Range[Prime[#],Prime[#+1]]&] (* Gus Wiseman, Dec 11 2024 *)
  • PARI
    isok(n) = for (k=prime(n)+1, prime(n+1)-1, if (!issquarefree(k), return (0))); 1; \\ Michel Marcus, Apr 29 2016

Formula

n such that A061398(n) = prime(n+1)-prime(n)-1.
prime(a(n)) = A061351(n). - Gus Wiseman, Dec 11 2024

A376596 Second differences of consecutive prime-powers inclusive (A000961). First differences of A057820.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Oct 02 2024

Keywords

Comments

For the exclusive version, shift left once.

Examples

			The prime-powers inclusive (A000961) are:
  1, 2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, 31, 32, 37, 41, 43, ...
with first differences (A057820):
  1, 1, 1, 1, 2, 1, 1, 2, 2, 3, 1, 2, 4, 2, 2, 2, 2, 1, 5, 4, 2, 4, 2, 4, 6, 2, 3, ...
with first differences (A376596):
  0, 0, 0, 1, -1, 0, 1, 0, 1, -2, 1, 2, -2, 0, 0, 0, -1, 4, -1, -2, 2, -2, 2, 2, ...
		

Crossrefs

The version for A000002 is A376604, first differences of A054354.
For first differences we had A057820, sorted firsts A376340(n)+1 (except first term).
Positions of zeros are A376597, complement A376598.
Sorted positions of first appearances are A376653, exclusive A376654.
A000961 lists prime-powers inclusive, exclusive A246655.
A001597 lists perfect-powers, complement A007916.
A023893 and A023894 count integer partitions into prime-powers, factorizations A000688.
A064113 lists positions of adjacent equal prime gaps.
For prime-powers inclusive: A057820 (first differences), A376597 (inflections and undulations), A376598 (nonzero curvature).
For second differences: A036263 (prime), A073445 (composite), A376559 (perfect-power), A376562 (non-perfect-power), A376590 (squarefree), A376593 (nonsquarefree), A376599 (non-prime-power).

Programs

  • Mathematica
    Differences[Select[Range[1000],#==1||PrimePowerQ[#]&],2]
  • Python
    from sympy import primepi, integer_nthroot
    def A376596(n):
        def iterfun(f,n=0):
            m, k = n, f(n)
            while m != k: m, k = k, f(k)
            return m
        def f(x): return int(n+x-1-sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length())))
        return (a:=iterfun(f,n))-((b:=iterfun(lambda x:f(x)+1,a))<<1)+iterfun(lambda x:f(x)+2,b) # Chai Wah Wu, Oct 02 2024
Showing 1-10 of 74 results. Next