[go: up one dir, main page]

login
First differences of sequence of consecutive prime powers (A000961).
101

%I #44 Oct 11 2024 10:19:08

%S 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,3,4,2,6,2,2,6,

%T 8,4,2,4,2,4,8,4,2,1,3,6,2,10,2,6,6,4,2,4,6,2,10,2,4,2,12,12,4,2,4,6,

%U 2,2,8,5,1,6,6,2,6,4,2,6,4,14,4,2,4,14,6,6,4,2,4,6,2,6,6,6,4,6,8,4,8,10,2,10

%N First differences of sequence of consecutive prime powers (A000961).

%C a(n) = 1 iff A000961(n) = A006549(k) for some k. - _Reinhard Zumkeller_, Aug 25 2002

%C Also run lengths of distinct terms in A070198. - _Reinhard Zumkeller_, Mar 01 2012

%C Does this sequence contain all positive integers? - _Gus Wiseman_, Oct 09 2024

%H Michael B. Porter, <a href="/A057820/b057820.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A000961(n+1) - A000961(n).

%e Odd differences arise in pairs in neighborhoods of powers of 2, like {..,2039,2048,2053,..} gives {..,11,5,..}

%p A057820 := proc(n)

%p A000961(n+1)-A000961(n) ;

%p end proc: # _R. J. Mathar_, Sep 23 2016

%t Map[Length, Split[Table[Apply[LCM, Range[n]], {n, 1, 150}]]] (* _Geoffrey Critzer_, May 29 2015 *)

%t Join[{1},Differences[Select[Range[500],PrimePowerQ]]] (* _Harvey P. Dale_, Apr 21 2022 *)

%o (PARI) isA000961(n) = (omega(n) == 1 || n == 1)

%o n_prev=1;for(n=2,500,if(isA000961(n),print(n-n_prev);n_prev=n)) \\ _Michael B. Porter_, Oct 30 2009

%o (Haskell)

%o a057820_list = zipWith (-) (tail a000961_list) a000961_list

%o -- _Reinhard Zumkeller_, Mar 01 2012

%o (Python)

%o from sympy import primepi, integer_nthroot

%o def A057820(n):

%o def f(x): return int(n+x-1-sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length())))

%o m, k = n, f(n)

%o while m != k: m, k = k, f(k)

%o r, k = m, f(m)+1

%o while r != k: r, k = k, f(k)+1

%o return r-m # _Chai Wah Wu_, Sep 12 2024

%Y Cf. A000961, A036616, A001223.

%Y For perfect-powers (A001597) we have A053289.

%Y For non-perfect-powers (A007916) we have A375706.

%Y Positions of ones are A375734.

%Y Run-compression is A376308.

%Y Run-lengths are A376309.

%Y Sorted positions of first appearances are A376340.

%Y The second (instead of first) differences are A376596, zeros A376597.

%Y Prime-powers:

%Y - terms: A000961 or A246655, complement A024619

%Y - differences: A057820 (this), first appearances A376341

%Y - runs: A373675, A373673, A373674, A174965

%Y - anti-runs: A373576, A120430, A006549, A373671

%Y Non-prime-powers:

%Y - terms: A361102

%Y - differences: A375708 (ones A375713)

%Y - runs: A373678, A373676, A373677, A110969 (A373669, sorted A373670)

%Y - anti-runs: A373679, A373575, A255346, A373672

%Y Cf. A000015, A014210, A014963, A025475, A025528, A027833, A037201, A046933, A076259, A078147, A093555, A345531, A376310.

%K nonn

%O 1,5

%A _Labos Elemer_, Nov 08 2000

%E Offset corrected and b-file adjusted by _Reinhard Zumkeller_, Mar 03 2012