# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a344681 Showing 1-1 of 1 %I A344681 #29 Nov 11 2023 03:38:36 %S A344681 1,3,20737,9,7,25,31,15,127,17,73,15,23,33,3479,21,31,65,131071,51, %T A344681 524287,31,127,33,47,69,31,39,49,43,233,87,1361567,45,89,51,71,73,223, %U A344681 57,79,65,13367,51,431,63,73,69,2351,97,127,63,103,65,6361,73,89,63,721,87,179951 %N A344681 a(n) is the smallest k > n such that 2^(k-n) == 1 (mod k). %C A344681 Smallest odd k > n such that 2^k == 2^n (mod k). %C A344681 a(n) is the smallest odd k > n such that A002326((k-1)/2) divides k-n. %C A344681 If a(n) is a prime p, then 2^(n-1) == 1 (mod p). %C A344681 Note that a(2n+2) <= A002184(n) for n > 0. %C A344681 If p is an odd prime, then a(p) <= p^2. %H A344681 Michel Marcus, Table of n, a(n) for n = 0..149 %t A344681 a[0] = 1; a[n_] := Module[{k = n + 1}, While[PowerMod[2, k - n, k] != 1, k++]; %t A344681 k]; Array[a, 60, 0] (* _Amiram Eldar_, Aug 17 2021 *) %o A344681 (Python) %o A344681 def a(n): %o A344681 if n == 0: return 1 %o A344681 k = n + 1 %o A344681 while pow(2, k-n, k) != 1: k += 1 %o A344681 return k %o A344681 print([a(n) for n in range(61)]) # _Michael S. Branicky_, Aug 17 2021 %o A344681 (PARI) a(n) = my(k=n+1); while(Mod(2, k)^(k-n) != 1, k++); k; \\ _Michel Marcus_, Aug 17 2021 %Y A344681 Cf. A002184, A002326, A346988. %K A344681 nonn %O A344681 0,2 %A A344681 _Thomas Ordowski_, Aug 17 2021 %E A344681 More terms from _Amiram Eldar_, Aug 17 2021 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE