Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A134269 Number of solutions to the equation p^k - p^(k-1) = n, where k is a positive integer and p is prime. 2

%I #22 Nov 09 2018 21:58:15

%S 1,2,0,2,0,2,0,1,0,1,0,1,0,0,0,2,0,2,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,

%T 0,1,0,0,0,1,0,2,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,

%U 0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,2,0,1,0,0,0

%N Number of solutions to the equation p^k - p^(k-1) = n, where k is a positive integer and p is prime.

%C The Euler phi function A000010 (number of integers less than n which are coprime with n) involves calculating the expression p^(k-1)*(p-1), where p is prime. For example phi(120) = phi(2^3*3*5) = (2^3-2^2)*(3-1)*(5-1) = 4*2*4 = 32.

%H Antti Karttunen, <a href="/A134269/b134269.txt">Table of n, a(n) for n = 1..65537</a>

%e Notice that it is not possible to have more than 2 solutions, but say when n=4 there are two solutions, namely 5^1 - 5^0 and 2^3 - 2^2.

%e a(2) = 2 refers to 2^2 - 2^1 = 2 and 3^1 - 3^0 = 2.

%e a(6) = 2 as 6 = 3^2 - 3^1 = 7^1 - 7^0.

%p A134269 := proc(n)

%p local a,p,r ;

%p a := 0 ;

%p p :=2 ;

%p while p <= n+1 do

%p r := n/(p-1) ;

%p if type(r,'integer') then

%p if r = 1 then

%p a := a+1 ;

%p else

%p r := ifactors(r)[2] ;

%p if nops(r) = 1 then

%p if op(1,op(1,r)) = p then

%p a := a+1 ;

%p end if;

%p end if;

%p end if;

%p end if;

%p p := nextprime(p) ;

%p end do:

%p return a;

%p end proc: # _R. J. Mathar_, Aug 06 2013

%o (PARI) lista(N=100) = {tab = vector(N); for (i=1, N, p = prime(i); for (j=1, N, v = p^j-p^(j-1); if (v <= #tab, tab[v]++););); for (i=1, #tab, print1(tab[i], ", "));} \\ _Michel Marcus_, Aug 06 2013

%o (PARI)

%o A134269list(up_to) = { my(v=vector(up_to)); forprime(p=2,1+up_to, for(j=1,oo,my(d = (p^j)-(p^(j-1))); if(d>up_to,break,v[d]++))); (v); };

%o v134269 = A134269list(up_to);

%o A134269(n) = v134269[n]; \\ _Antti Karttunen_, Nov 09 2018

%Y Cf. A000010, A014197, A114871, A114873, A114874.

%K nonn

%O 1,2

%A _Anthony C Robin_, Jan 15 2008

%E a(2) corrected by _Michel Marcus_, Aug 06 2013

%E More terms from _Antti Karttunen_, Nov 09 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 18 20:50 EDT 2024. Contains 375284 sequences. (Running on oeis4.)