A246702 The number of positive k < (2n-1)^2 such that (2^k - 1)/(2n - 1)^2 is an integer.
0, 1, 1, 2, 1, 1, 1, 3, 2, 1, 10, 2, 1, 1, 1, 6, 3, 2, 1, 9, 2, 3, 3, 2, 2, 6, 1, 13, 9, 1, 1, 10, 5, 1, 3, 2, 8, 3, 2, 2, 1, 1, 10, 3, 8, 7, 9, 2, 2, 3, 1, 2, 26, 1, 3, 9, 4, 2, 9, 4, 1, 6, 1, 18, 9, 1, 7, 3, 2, 1, 3, 2, 5, 10, 1, 10, 6, 38, 3, 3, 4, 1, 41, 2
Offset: 1
Keywords
Examples
a(2) = 1 because (2^6 - 1)/(2*2 - 1)^2 = 7 is an integer and 6 < 9. a(3) = 1 because (2^20 - 1)/(2*3 - 1)^2 = 41943 is an integer and 20 < 25. a(3) = 2 because (2^21 - 1)/(2*4 - 1)^2 = 42799 is an integer and 21 < 49; and also (2^42 - 1)/(2*4 - 1)^2 = 89756051247 is an integer and 42 < 49.
Links
- Kevin P. Thompson, Table of n, a(n) for n = 1..1560 (terms 1..128 from Antti Karttunen)
Programs
-
Maple
A246702 := proc(n) local a,klim,k ; a := 0 ; klim := (2*n-1)^2 ; for k from 1 to klim-1 do if modp(2^k-1,klim) = 0 then a := a+1 ; end if; end do: a ; end proc: seq(A246702(n),n=1..80) ; # R. J. Mathar, Nov 15 2014
-
Mathematica
A246702[n_] := Module[{a, klim, k}, a = 0; klim = (2*n-1)^2; For[k = 1, k <= klim-1, k++, If[Mod[2^k-1, klim] == 0, a = a+1]]; a]; Table[A246702[n], {n, 1, 84}] (* Jean-François Alcover, Oct 04 2017, translated from R. J. Mathar's Maple code *)
-
PARI
a(n)=my(t=(2*n-1)^2,m=Mod(1,t)); sum(k=1,t-1,m*=2;m==1) \\ Charles R Greathouse IV, Nov 16 2014
-
PARI
a246702(n) = my(m=(2*n-1)^2); (m-1)\znorder(Mod(2,m)); \\ Max Alekseyev, Oct 11 2023
-
Scheme
(define (A246702 n) (let ((u (A016754 (- n 1)))) (let loop ((k (- u 1)) (s 0)) (cond ((zero? k) s) ((zero? (modulo (A000225 k) u)) (loop (- k 1) (+ s 1))) (else (loop (- k 1) s)))))) ;; Antti Karttunen, Nov 15 2014
Formula
a(n) = floor( 4*n*(n-1) / A002326(2*n*(n-1)) ). - Max Alekseyev, Oct 11 2023
Extensions
Corrected by R. J. Mathar, Nov 15 2014
Comments