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!)
A279857 Prime numbers p with the property that p is the sum of the squares of two or more distinct one-digit numbers. 0
5, 13, 17, 29, 37, 41, 53, 59, 61, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 163, 167, 179, 181, 191, 197, 199, 211, 223, 227, 229, 233, 239, 251, 269, 271, 281 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
EXAMPLE
5 is in the sequence because 5 = 1^2 + 2^2.
13 is in the sequence because 13 = 2^2 + 3^2.
MATHEMATICA
list = {};
squares = Subsets[{1, 2, 3, 4, 5, 6, 7, 8, 9}]^2;
For[i=1, i≤Length[squares], i++,
If[PrimeQ[Total[squares[[i]] ]], AppendTo[list, Total[squares[[i]] ]]]];
Intersection[list] (* Robert Price, Dec 20 2016 *)
Select[Union[Total/@Subsets[Range[9]^2, {2, 9}]], PrimeQ] (* Harvey P. Dale, Jul 20 2020 *)
PROG
(MiniZinc)
% In the modeling language MiniZinc each prime number n belonging to the sequence produces a satisfactory solution for this model:
include "all_different.mzn";
int: n;
var 1..9: A;
var 1..9: B;
var 1..9: C;
var 1..9: D;
var 1..9: E;
var 1..9: F;
var 1..9: G;
var 1..9: H;
var 1..9: I;
var 0..1: nA; var 0..1: nB; var 0..1: nC; var 0..1: nD; var 0..1: nE; var 0..1: nF; var 0..1: nG; var 0..1: nH; var 0..1: nI;
solve satisfy;
constraint all_different([A, B, C, D, E, F, G, H, I]) /\
n=(A*A*nA+B*B*nB+C*C*nC+D*D*nD+E*E*nE+F*F*nF+G*G*nG+H*H*nH+I*I*nI)
(Python)
from sympy import isprime
from itertools import chain, combinations
def powerset(s): # skipping empty set and singletons
return chain.from_iterable(combinations(s, r) for r in range(2, len(s)+1))
def aupto(limit):
sosds = set(sum(ss) for ss in powerset([i**2 for i in range(1, 10)]))
return sorted(filter(isprime, (t for t in sosds if t <= limit)))
print(aupto(281)) # Michael S. Branicky, May 13 2021
CROSSREFS
Sequence in context: A265889 A359151 A191218 * A077426 A231754 A175768
KEYWORD
nonn,base,fini,full
AUTHOR
Pierandrea Formusa, Dec 20 2016
STATUS
approved

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 April 25 09:11 EDT 2024. Contains 371964 sequences. (Running on oeis4.)