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.
%I A176997 #30 Apr 21 2024 18:12:47 %S A176997 1,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89, %T A176997 97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179, %U A176997 181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331 %N A176997 Integers k such that 2^(k-1) == 1 (mod k). %C A176997 Old definition was: Odd integers n such that 2^(n-1) == 4^(n-1) == 8^(n-1) == ... == k^(n-1) (mod n), where k = A062383(n). Dividing 2^(n-1) == 4^(n-1) (mod n) by 2^(n-1), we get 1 == 2^(n-1) (mod n), implying the current definition. - _Max Alekseyev_, Sep 22 2016 %C A176997 The union of {1}, the odd primes, and the Fermat pseudoprimes, i.e., {1} U A065091 U A001567. Also, the union of A006005 and A001567 (conjectured by _Alois P. Heinz_, Dec 10 2010). - _Max Alekseyev_, Sep 22 2016 %C A176997 These numbers were called "fermatians" by Shanks (1962). - _Amiram Eldar_, Apr 21 2024 %D A176997 Daniel Shanks, Solved and Unsolved Problems in Number Theory, Spartan Books, Washington D.C., 1962. %H A176997 Seiichi Manyama, <a href="/A176997/b176997.txt">Table of n, a(n) for n = 1..10000</a> %e A176997 5 is in the sequence because 2^(5-1) == 4^(5-1) == 8^(5-1) == 1 (mod 5). %t A176997 m = 1; Join[Select[Range[m], Divisible[2^(# - 1) - m, #] &], %t A176997 Select[Range[m + 1, 10^3], PowerMod[2, # - 1, #] == m &]] (* _Robert Price_, Oct 12 2018 *) %o A176997 (PARI) isok(n) = Mod(2, n)^(n-1) == 1; \\ _Michel Marcus_, Sep 23 2016 %o A176997 (Python) %o A176997 from itertools import count, islice %o A176997 def A176997_gen(startvalue=1): # generator of terms >= startvalue %o A176997 if startvalue <= 1: %o A176997 yield 1 %o A176997 k = 1<<(s:=max(startvalue,1))-1 %o A176997 for n in count(s): %o A176997 if k % n == 1: %o A176997 yield n %o A176997 k <<= 1 %o A176997 A176997_list = list(islice(A176997_gen(),30)) # _Chai Wah Wu_, Jun 30 2022 %Y A176997 The odd terms of A015919. %Y A176997 Odd integers n such that 2^n == 2^k (mod n): this sequence (k=1), A173572 (k=2), A276967 (k=3), A033984 (k=4), A276968 (k=5), A215610 (k=6), A276969 (k=7), A215611 (k=8), A276970 (k=9), A215612 (k=10), A276971 (k=11), A215613 (k=12). %Y A176997 Cf. A000079, A062173, A062175, A176817. %K A176997 nonn %O A176997 1,2 %A A176997 _Juri-Stepan Gerasimov_, Dec 08 2010 %E A176997 Edited by _Max Alekseyev_, Sep 22 2016