cp's OEIS Frontend

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.

A329269 Integers k such that 8*k + 1 is a prime or a square.

This page as a plain text file.
%I A329269 #54 Sep 06 2023 13:41:12
%S A329269 0,1,2,3,5,6,9,10,11,12,14,15,17,21,24,28,29,30,32,35,36,39,42,44,45,
%T A329269 50,51,54,55,56,57,65,66,71,72,74,75,77,78,80,84,91,95,96,101,105,107,
%U A329269 110,116,117,119,120,122,126,129,131,136,137,141,144,149,150
%N A329269 Integers k such that 8*k + 1 is a prime or a square.
%C A329269 All odd squares have the form 8*n + 1.
%D A329269 G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, theorem 14 and ch. 4.5
%e A329269 8*0 + 1 =  1 = 1^2, so 0 is a term;
%e A329269 8*1 + 1 =  9 = 3^2, so 1 is a term;
%e A329269 8*2 + 1 = 17 = prime(7), so 2 is a term;
%e A329269 8*3 + 1 = 25 = 5^2, so 3 is a term;
%e A329269 8*4 + 1 = 33 is neither prime nor square, so 4 is not a term;
%e A329269 8*5 + 1 = 41 = prime(13), so 5 is a term.
%p A329269 q:= k-> (t-> isprime(t) or issqr(t))(8*k+1):
%p A329269 select(q, [$0..200])[];  # _Alois P. Heinz_, Feb 25 2020
%t A329269 Select[Range[0, 150], PrimeQ[(m = 8*# + 1)] || IntegerQ @ Sqrt[m] &] (* _Amiram Eldar_, Feb 29 2020 *)
%o A329269 (Rexx)
%o A329269 S = 0 ;  U = 1 ;  P = 1
%o A329269 do N = 1 while length( S ) < 256
%o A329269    C = 8 * N + 1
%o A329269    do I = U by 2
%o A329269       K = I * I      ;  if K > C then  leave I
%o A329269       U = I          ;  if K < C then  iterate I
%o A329269       S = S || ',' N ;  iterate N
%o A329269    end I
%o A329269    do I = P
%o A329269       K = PRIME( I ) ;  if K > C then  leave I
%o A329269       P = I          ;  if K < C then  iterate I
%o A329269       S = S || ',' N ;  iterate N
%o A329269    end I
%o A329269 end N
%o A329269 say S ;  return S
%o A329269 (PARI) isok(k) = my(x=8*k+1); isprime(x) || issquare(x); \\ _Michel Marcus_, Feb 27 2020
%Y A329269 Union of the triangular numbers A000217 and A005123.
%Y A329269 Cf. A000040, A016754 (odd squares).
%K A329269 nonn,easy
%O A329269 1,3
%A A329269 _Frank Ellermann_, Feb 23 2020