A180337 Numbers which cannot be expressed as a sum 1 + p1 + p1*p2 + p1*p2*p3 + ... for some collection of primes {p1, p2, p3, ...}.
2, 5, 11, 23, 26, 47, 56, 95, 116, 122, 236, 254, 518, 530, 1082, 2210
Offset: 1
Keywords
Examples
8 is not a member of the sequence since it is equal to 1 + 7. 9 is not a member of the sequence since it can be written 1 + 2 + 2*3. 10 is not a member of the sequence since it is equal to 1 + 3 + 3*2. 11 is a member of the sequence. If 11 could be written in this form, then p1 must divide 10. We would have 11 = 1 + p1(1 + p2 + ...), which would imply that 5 is not a member of the sequence if p1 = 2, or vice versa. Since both 2 nor 5 are members, so is 11.
Programs
-
Maple
q:= proc(n) option remember; is(n=1 or ormap(p-> q((n-1)/p), numtheory[factorset](n-1))) end: remove(q, [$1..3000])[]; # Alois P. Heinz, Jul 24 2018
-
Mathematica
q[1] = True; q[2] = False; q[n_] := q[n] = AnyTrue[FactorInteger[n-1][[All, 1]], q[(n-1)/#]&]; Select[Range[3000], !q[#]&] (* Jean-François Alcover, Nov 11 2020, after Alois P. Heinz *)
-
Perl
#!/usr/bin/perl $max = 10; if (defined($ARGV[0])) { $max = $ARGV[0]; } $primes{1} = 0; $list{1} = 1; $list{2} = 0; print "2, "; foreach $k (2..$max){ $p = 1; $l = 0; foreach $j (1..$k) { if ($primes{$j}){ if (($k % $j) == 0){ $p = 0; if ($list{$k / $j}){ $l = 1; } } } } $primes{$k} = $p; $list{$k + 1} = $l || $p; if (!$list{$k + 1}){ $t = $k + 1; print "$t, " } }
Formula
A317240(a(n)) = 0. - Alois P. Heinz, Jul 24 2018
Comments